Development Long read Aws
Design your VPC network

Design your VPC network

Elastic IP, subnet, and routing.

5 April 2026 20 min read
Share
X in

Introduction

VPC defines your isolated network in AWS. Subnet, route table, internet gateway, and NAT determine traffic flow.

Elastic IP (EIP) is a static public IPv4 address; preserved when instance restarts.

This guide covers basic VPC architecture and Elastic IP use cases.

VPC Core Components

VPC CIDR (10.0.0.0/16) defines IP range. Public subnet reaches internet via IGW route. Private subnet uses NAT Gateway.

Route table attaches to subnet; 0.0.0.0/0 → igw-xxxxx routes internet traffic.

aws ec2 create-vpc --cidr-block 10.0.0.0/16
aws ec2 create-subnet --vpc-id vpc-xxx --cidr-block 10.0.1.0/24
aws ec2 create-internet-gateway

Elastic IP

allocate-address allocates new EIP. associate-address attaches to instance or ENI. Unused EIP is billed hourly.

Instance stop/start may change public IP; EIP stays fixed. Use EIP or ALB in production.

aws ec2 allocate-address --domain vpc
aws ec2 associate-address \
  --instance-id i-xxx \
  --allocation-id eipalloc-xxx

NAT Gateway

Instances in private subnet reach internet via NAT Gateway (updates, API calls). NAT must be in public subnet.

NAT Gateway is highly available but has hourly + data transfer cost. NAT Instance is older cheaper alternative.

# Private subnet route table
Destination: 0.0.0.0/0 → nat-xxxxx

# Public subnet route table
Destination: 0.0.0.0/0 → igw-xxxxx

Security and NACL

Security Group is instance-level stateful firewall. NACL is subnet-level stateless; extra defense layer.

Default NACL allows all traffic; restrict with custom NACL.

  • SG: instance firewall
  • NACL: subnet firewall
  • Flow Logs: trafik analizi
  • VPC peering: çapraz VPC

Multi-AZ Architecture

Create public + private subnet per AZ. NAT Gateway per AZ (HA) or single NAT (cost). ALB distributes across AZ instances.

Plan subnet CIDR upfront; leave enough IPs for growth.

Kullanılmayan Elastic IP'leri release edin; aylık gereksiz maliyet oluştururlar.

Conclusion

VPC design is the foundation of application architecture. Public/private split, NAT, EIP, and SG together form a secure network.

Make VPC templates repeatable with infrastructure-as-code (Terraform).