I spent about three hours building a VPC in the AWS console for a NextWork project. I split it into four subnets across two Availability Zones, with one public and one private subnet in each. The part that took the most troubleshooting was figuring out where traffic could actually go.

Where the route stopped

I attached an internet gateway to the VPC and pointed the public subnets’ default route at it. At that point, the private subnets had zero internet connectivity. The gateway belonged to the whole VPC, but it only helped subnets whose route tables sent traffic to it.

That setup made sense until I considered something as ordinary as an OS update. I wanted an instance in a private subnet to be able to reach a package server and get a response. It still needed to stay private.

Following an update request

I put a NAT gateway in a public subnet and changed the private route table so its default route pointed to the NAT gateway. I could now follow an update request all the way out. The instance sent it to the NAT gateway, and the public subnet already had a route through the internet gateway.

The detail that finally made the routing clear was which table I had to change. The public route was already there. The missing piece was the private subnet’s next hop.

Getting a shell with zero inbound ports

I also wanted to manage an EC2 instance while leaving its security group with no inbound rules. I gave the instance an IAM role for Systems Manager and used Session Manager to open a shell. The agent on the instance initiated the connection, so I could leave SSH closed.

When I tried pinging the instance from my own machine, every packet timed out. Session Manager still gave me a shell. Seeing those two results side by side made me pay closer attention to which end of a connection starts it.

After doing all of this in the console, I wanted to see what it would take to build the network again from code. That became my next project with Terraform.

Thanks for reading.

More field notes