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-gatewayElastic 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-xxxNAT 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-xxxxxSecurity 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).