Your private subnet instances reach S3 through the NAT gateway and the bill is large. What do you do?
BeginnerScenarioVPC & Cloud Network Design
Answer
Situation read → NAT data processing charges apply to every GB, including traffic that never needs the internet.
What I'd do →
- Create an S3 gateway endpoint:
aws ec2 create-vpc-endpoint --vpc-id vpc-0abc --service-name com.amazonaws.eu-west-1.s3 --route-table-ids rtb-0abc - The endpoint adds a prefix-list route so S3 traffic bypasses NAT
- Do the same for DynamoDB (also a gateway endpoint)
- Confirm with Cost Explorer or flow logs that NAT bytes drop
Why → Gateway endpoints are free and keep the traffic on the AWS network.
Interview tip → Mention restricting the endpoint with an endpoint policy and bucket policy aws:SourceVpce.
More on VPC & Cloud Network Design
What makes a subnet public versus private in AWS?BeginnerExplain internet gateway versus NAT gateway and when you use each.BeginnerPrivate instances need to pull packages from the internet but must not be reachable from it. What do you set up?BeginnerWhy shouldn't production run in the default VPC?BeginnerPublic IP, Elastic IP and private IP: how do they differ on EC2?BeginnerWhy use SSM Session Manager instead of a bastion host?Beginner