Chapter 1: Networking Fundamentals
1.9 How these concepts map to AWS
Internet
|
+---------------+
| Internet GW | (1:1 NAT for public / Elastic IPs)
+---------------+
|
+------------------ VPC 10.0.0.0/16 ------------------------------+
| Public subnet 10.0.1.0/24 Private subnet 10.0.11.0/24 |
| +-----------------------+ +------------------------+ |
| | EC2 web server | | EC2 / RDS database | |
| | private 10.0.1.25 | -------> | private 10.0.11.40 | |
| | public 13.233.10.25 | | (no public IP) | |
| +-----------------------+ +-----------+------------+ |
| | | outbound only |
| +-------------+ <-------------------------+ |
| | NAT Gateway | (lets private hosts download updates) |
| +-------------+ |
+-----------------------------------------------------------------+
| Networking concept | AWS feature | Key points |
|---|---|---|
| Private IP | Primary private IPv4 of an EC2 ENI | From the subnet CIDR; stays the same for the life of the instance (even across stop/start) |
| Dynamic public IP | Auto-assigned public IPv4 | Released on stop; a new one is given on start. Lost for ever on terminate |
| Static public IP | Elastic IP (EIP) | Stays with your account until you release it; can be re-mapped to another instance. Charged hourly like all public IPv4 addresses |
| Private network | VPC with CIDR (e.g. 10.0.0.0/16) |
Choose from RFC 1918 ranges; /16 to /28 |
| Subnet | Subnet (lives in one AZ) | Public subnet = route 0.0.0.0/0 → Internet Gateway |
| NAT | NAT Gateway / Internet Gateway | IGW does 1:1 NAT for public IPs; NAT GW does many-to-one for private subnets |
| Firewall on ports | Security Group (stateful, instance level) and Network ACL (stateless, subnet level) | Allow 22 only from My IP; 80/443 from anywhere |
| DNS | Route 53 (Chapter 9), and public DNS names like ec2-13-233-10-25.ap-south-1.compute.amazonaws.com |
Mumbai and Hyderabad regions
For users in Maharashtra, the Asia Pacific (Mumbai) ap-south-1 region gives the lowest latency. ap-south-2 (Hyderabad) is the other Indian region.
Public IP changes after stop/start
If your website stops working after you stop and start an instance, check the public IP — it has probably changed. Use an Elastic IP (or a load balancer / DNS name) for anything that must keep a fixed address — we practise this in Chapter 14.