Back to aws
aws#aws#vpc#networking

AWS Networking: VPC, Subnets and Security Groups

Your own private network inside AWS — public vs private subnets, security groups vs NACLs, all in beginner language.

Jane Contributor August 2, 2026 1 views

AWS Networking Basics

Every AWS account gets a default VPC (Virtual Private Cloud) — your own private network inside AWS.

The Lego bricks

VPC   10.0.0.0/16   ("the neighbourhood")
├── Public Subnet   10.0.1.0/24  (facing internet)
│     └── EC2 instances that need public IPs
├── Private Subnet  10.0.2.0/24  (behind a NAT)
│     └── Databases, internal APIs
├── Internet Gateway   (door to the internet)
└── NAT Gateway        (private subnet → internet, one-way)

Security Groups vs NACLs

Security GroupNetwork ACL
Attaches toInstanceSubnet
RulesAllow-only (implicit deny)Allow + Deny
StateStateful (return traffic auto)Stateless
Beginner adviceUse this 99% of the timeOnly if you need extra layer

A public subnet in plain YAML (CloudFormation)

Resources:
  MyVPC:
    Type: AWS::EC2::VPC
    Properties: { CidrBlock: 10.0.0.0/16 }
  PublicSubnet:
    Type: AWS::EC2::Subnet
    Properties:
      VpcId: !Ref MyVPC
      CidrBlock: 10.0.1.0/24
      MapPublicIpOnLaunch: true

Real-world tip

You almost never expose databases to the internet — put them in a private subnet and connect through the app tier. This alone prevents 90% of accidental data leaks.

Keep reading

You may also like

Discussion (0)

No comments yet. Be the first to weigh in.

Leave a comment

Comments are reviewed before appearing.