Sitemap
Ramya Sree G

Ramya Sree G

Associate DevOps Engineer | AWS | K8s | Programming | Networking |

๐—ก๐—”๐—ง ๐—š๐—ฎ๐˜๐—ฒ๐˜„๐—ฎ๐˜†

2 min readFeb 19, 2026

๐Ÿ‘‰ ๐—›๐—ผ๐˜„ ๐—–๐—ฎ๐—ป ๐—ฎ ๐—ฃ๐—ฟ๐—ถ๐˜ƒ๐—ฎ๐˜๐—ฒ ๐—ฆ๐—ฒ๐—ฟ๐˜ƒ๐—ฒ๐—ฟ ๐—”๐—ฐ๐—ฐ๐—ฒ๐˜€๐˜€ ๐˜๐—ต๐—ฒ ๐—œ๐—ป๐˜๐—ฒ๐—ฟ๐—ป๐—ฒ๐˜ ๐—ณ๐—ผ๐—ฟ ๐—จ๐—ฝ๐—ฑ๐—ฎ๐˜๐—ฒ๐˜€ & ๐—ฃ๐—ฎ๐˜๐—ฐ๐—ต๐—ฒ๐˜€? ๐Ÿค”

Weโ€™re done with ๐—ฉ๐—ฃ๐—–, ๐—ฆ๐˜‚๐—ฏ๐—ป๐—ฒ๐˜๐˜€, ๐—ฅ๐—ผ๐˜‚๐˜๐—ถ๐—ป๐—ด, and ๐—œ๐—ป๐˜๐—ฒ๐—ฟ๐—ป๐—ฒ๐˜ ๐—š๐—ฎ๐˜๐—ฒ๐˜„๐—ฎ๐˜†.
Now letโ€™s deep dive into something critical in real-world AWS architecture โ€” ๐—ก๐—”๐—ง ๐—š๐—ฎ๐˜๐—ฒ๐˜„๐—ฎ๐˜† ๐Ÿš€

Get Ramya Sree Gโ€™s stories inย yourย inbox

Join Medium for free to get updates fromย thisย writer.

๐Ÿšจ ๐—ง๐—ต๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ฏ๐—น๐—ฒ๐—บ
A server inside a private subnet needs internet access for:
โ€ข OS updates
โ€ข Security patches
โ€ข Installing packages
Butโ€ฆ we donโ€™t want the internet to initiate connections to that server.
So how do we solve this? ๐Ÿค”

โœ… ๐—ง๐—ต๐—ฒ ๐—ฆ๐—ผ๐—น๐˜‚๐˜๐—ถ๐—ผ๐—ป โ€” ๐—ก๐—”๐—ง ๐—š๐—ฎ๐˜๐—ฒ๐˜„๐—ฎ๐˜†
NAT performs source network address translation (SNAT) โ€” it replaces the private IP with its Elastic IP when sending traffic to the internet.

A NAT Gateway is deployed in a public subnet.
That means:
โ€ข It has a public IP
โ€ข It can access the internet
โ€ข It acts as an intermediary
Traffic flow looks like this:
Private EC2 โ†’ NAT Gateway โ†’ IGW โ†’ Internet
Important:
The internet cannot initiate a connection back to the private instance because it does not have a public IP. This is called ๐—ข๐˜‚๐˜๐—ฏ๐—ผ๐˜‚๐—ป๐—ฑ ๐—œ๐—ป๐˜๐—ฒ๐—ฟ๐—ป๐—ฒ๐˜ ๐—ข๐—ป๐—น๐˜† ๐—”๐—ฐ๐—ฐ๐—ฒ๐˜€๐˜€ ๐Ÿ”

๐Ÿ”„ ๐—›๐—ผ๐˜„ ๐—œ๐˜ ๐—ช๐—ผ๐—ฟ๐—ธ๐˜€
1๏ธโƒฃ Create VPC
2๏ธโƒฃ Create Public & Private Subnets
3๏ธโƒฃ Attach IGW to VPC
4๏ธโƒฃ Public route table โ†’ any IP โ†’ IGW
5๏ธโƒฃ Deploy NAT Gateway in Public Subnet
6๏ธโƒฃ Private route table โ†’ any IP โ†’ NAT Gateway
Now your private servers can access internet safely.

Press enter or click to view image in full size

๐Ÿš€ NAT requires:
Elastic IP
Must be placed in public subnet
Public subnet must have route to IGW
Without IGW, NAT wonโ€™t work.
That dependency is very important.

๐Ÿ’ฐ ๐—ฃ๐—ฟ๐—ถ๐—ฐ๐—ถ๐—ป๐—ด ๐—ฅ๐—ฒ๐—บ๐—ถ๐—ป๐—ฑ๐—ฒ๐—ฟ
NAT Gateway is charged:
โ€ข Per hour
โ€ข Per GB of data processed
Architecture is always a balance between:
Security ๐Ÿ”
Availability ๐ŸŒ
Cost ๐Ÿ’ฐ

โš–๏ธ ๐—ก๐—”๐—ง ๐—š๐—ฎ๐˜๐—ฒ๐˜„๐—ฎ๐˜† ๐˜ƒ๐˜€ ๐—œ๐—š๐—ช (main difference)
โ€ข IGW is region-resilient
โ€ข NAT Gateway is AZ-specific
If an AZ goes down โ†’ NAT in that AZ goes down too.
For high availability, deploy NAT in multiple AZs. But remember โ€” cost increases.

Cloud is not just about creating resources.
Itโ€™s about designing smartly.
Stay tuned as we break down more AWS micro-concepts step by step ๐Ÿš€

--

--

Ramya Sree G
Ramya Sree G

Written by Ramya Sree G

Associate DevOps Engineer | AWS | K8s | Programming | Networking |