Over 6,000 mentors available, including leaders at Amazon, Airbnb, Netflix, and more. Check it out

Day in the Life of a VPC Packet

Follow Patty's Journey from EC2 to the Internet and Discover the Hidden World Inside Your AWS Network
Akshay Kapoor
15+ years of experience in Software and Cloud
Get in touch

Meet “Patty” the Packet

Let’s imagine you’re sitting at your desk, curious about what really happens when your EC2 instance tries to reach out to something over the internet. Maybe you’ve set up a new server and want to make sure it can talk to the outside world, or perhaps you’re just fascinated by the magic behind the scenes.

Meet Patty, our friendly packet. Today, we’ll follow her on her journey from your AWS VPC all the way to google.com. Along the way, I’ll break down each step so you can feel confident about how egress traffic works in AWS.

EC2 instance sends DNS resolution request to Route53, before initiating a connection

Patty’s home: Inside the EC2 instance

Patty’s story begins inside an EC2 instance, quietly humming away in your AWS VPC. The EC2 instance might be running a web app, or perhaps it’s just a simple Linux box you spun up for testing. Either way, Patty is ready to head out and see the world. Or at least, to fetch some data from Google. But before she can leave, Patty needs to understand her surroundings. Is she even allowed to step out?

Let’s assume the EC2 instance is deployed in a private subnet, with the IP address 10.142.13.13, and the ephemeral port traffic initiates from is 33996

First Checkpoint: Security Group Inspection

As Patty gets ready to leave her EC2 home, she meets her first guardian — the Security Group. Think of this as a helpful doorman who checks if Patty is allowed to go out. Security Groups are all about rules — specifically, what kind of traffic can leave and where it can go.

If you’ve ever wondered why some connections just don’t work, this is often the first place to check.

Security Group rules attached to the network interface enforce inbound/outbound rules

Patty requests the network interface attached to the instance, which then checks with the associated Security Group: Is outbound HTTPS (port 443) allowed? If yes, she’s on her way. If not, she’ll have to wait until you update the rules.

The Neighborhood Gate: Network ACLs

Next up, Patty arrives at the Network ACL (Access Control List)— kind of like the gate at the end of your street. These rules are a bit stricter and apply to the whole subnet which the ENI got it’s IP from, not just Patty’s house.

Network ACLs check both outgoing and incoming traffic, and they don’t remember Patty from previous interactions. If the rules say “no” to her destination or port, Patty’s journey stops here. But if everything checks out, she’s free to move on.

If you ever get stuck troubleshooting weird network issues, double-check these gates; they can be sneaky!

Subnet NACLs enforce security checks at the Subnet-level, before Patty gets routed to the next hop

Looking for the Way Out: Route Table Decisions

With the Security Group and NACL behind her, Patty needs to figure out which road to take next. That’s where the Subnet Route Table comes in — it’s like a map for the subnet. For private subnets, the map usually points all internet-bound traffic to a NAT Gateway. If Patty’s in a public subnet, the map might send her straight to the Internet Gateway. In latter, the EC2 instance would have a public IP-address associated with it’s ENI, which permits it to directly speak to internet endpoints.

If you’ve ever wondered why your instance can’t reach the internet, check the route table — it might be missing a road!

Subnet Route Tables define the next hop for packets when they leave a subnet

The NAT Gateway: Patty’s Passport to the Internet

If Patty is coming from a private subnet, she’ll stop at the NAT Gateway. This is her passport office, where her private IP gets swapped for a public one.

The NAT Gateway is there to protect your private resources while still letting them reach out to the world. It’s a bit like sending mail from a secure building — your address stays hidden, but your message gets delivered.

This is a common spot where things go wrong, especially if the NAT Gateway isn’t set up or funded (watch out for those AWS costs!)

NAT Gateway replaces Patty's source IP address (from EC2 instance) with it's own public IP

Exiting the VPC: The Internet Gateway

Now Patty’s ready to leave the safety of your VPC. The Internet Gateway is her AWS official exit — think of it as the airport gate that connects your private AWS world to the open internet. Without an Internet Gateway, there’s simply no way out.

If you’re ever scratching your head about connectivity issues, make sure your VPC has this door installed and that your public-subnet routes lead to it.

NAT Gateway finally sends Patty to VPC's Internet Gateway

Out in the Wild: Journey Across the Internet

Patty is now out in the wild, traveling across routers, ISPs, and who-knows-what on her way to google.com. This part of the journey is a bit mysterious and out of your hands, but as long as she left with the right address and passport, she’ll get there.

It’s a good reminder that, while AWS gives you lots of control, the internet itself is a big, unpredictable place.

Patty travels across the internet, to Google's servers

Arrival at Destination: Reaching Google.com

Finally, Patty arrives at google.com, ready to deliver her message. Google’s servers will process her request and send a response right back, retracing the same path in reverse.

If you’ve ever wondered why some requests are slow or get dropped, remember how many steps are involved — there’s a lot happening behind the scenes!

The Journey Home: How Google’s Response Finds Its Way Back

Once Patty’s message reaches google.com, Google’s servers get to work and craft a response — let’s call this return traveler Ricky, the Response Packet.

Now, Ricky needs to find his way back to the original EC2 instance inside your VPC. Let’s walk with Ricky as he retraces Patty’s outbound steps, but in reverse.

Ricky first leaves Google’s servers and travels across the unpredictable landscape of the internet, hopping between routers and networks, guided by the destination public IP address (the one assigned to your NAT Gateway). When Ricky arrives at the edge of your AWS environment, he’s greeted by the Internet Gateway — the official entry point into your VPC.

The Internet Gateway checks Ricky’s credentials and, seeing that he’s addressed to the NAT Gateway’s public IP, forwards him along.

However, before it sends Ricky to the NAT Gateway, it replaces the destination public IP with NAT Gateway’s internal private IP. Remember, inside AWS network, it’s all private IPs now.

The NAT Gateway then translates Ricky’s destination address back to the private IP of the original EC2 instance, remembering the connection that Patty started earlier. This translation is seamless, but it’s a crucial step — without it, Ricky would never find his way inside!

Next, Ricky consults the route table for directions to the right subnet and is sent toward the private subnet where the EC2 instance lives. As he approaches, he faces the Network ACL, which checks if inbound responses like Ricky’s are allowed. If the rules are set correctly, Ricky gets the green light to proceed.

Almost home, Ricky encounters the Security Group attached to the EC2 instance. This is the final check: does the Security Group allow inbound traffic for this established connection? Since it’s a response to a request initiated by Patty, and Security Groups are stateful (they remember outgoing requests), Ricky is welcomed in.

Finally, Ricky arrives at the EC2 instance, carrying Google’s response back to the application that started it all. The round trip is complete!

Tracing Ricky's response path after it reaches the VPCs' Internet Gateway

Conclusion: Lessons from Patty’s Adventure

We hope Patty’s journey has made the AWS egress flow a little less intimidating. Whether you’re troubleshooting connectivity, setting up a new server, or just curious, knowing these steps can save you hours of head-scratching.

Remember:

  • Security Groups are your first line of defense
  • Network ACLs are the neighborhood gate
  • Route tables are your map
  • NAT Gateways and Internet Gateways are your passport and airport

If you ever get stuck, retrace Patty’s steps. And if you have questions, you’re not alone — reach out, ask, and keep learning. Happy networking!

Ready to find the right
mentor for your goals?

Find out if MentorCruise is a good fit for you – fast, free, and no pressure.

Tell us about your goals

See how mentorship compares to other options

Preview your first month