Certopolis

AWS Certified Solutions Architect – Associate

NAT gateway costs, gateway endpoints and data transfer charges

A NAT gateway charges per hour and per GB it processes. When private instances send heavy traffic to Amazon S3 or DynamoDB in the same Region, a gateway endpoint takes that traffic off the NAT gateway at no extra charge. Keep chatty resources in the same Availability Zone as their NAT gateway, because traffic between zones is billed too.

What a NAT gateway costs

You pay for each hour a NAT gateway is available and for each GB it processes. AWS suggests two ways to cut the processing charge. Keep resources that send a lot of traffic in the same Availability Zone as the NAT gateway, or create a NAT gateway in each zone that has resources. And send traffic for AWS services through gateway or interface endpoints instead of the NAT gateway.

A NAT gateway in each Availability Zone also means one zone's failure does not cut off the others. It adds hourly charges and removes cross-zone traffic.

Gateway endpoints vs interface endpoints

Gateway endpoints exist only for Amazon S3 and DynamoDB, and there is no additional charge for them. You associate the endpoint with subnet route tables, and AWS adds a route whose destination is the service's prefix list. Only subnets whose route table is associated use it.

A gateway endpoint can't be used from on-premises networks, from another Region, or through a transit gateway. Interface endpoints use private IP addresses in your subnets, can be reached over Direct Connect, VPN, VPC peering or a transit gateway, and are billed.

You can run both in one VPC for S3. In-VPC traffic uses the free gateway endpoint and on-premises traffic uses the interface endpoint.

How data transfer is billed

Data coming into AWS from the internet is free. Data going out to the internet is charged.

Data moving between Availability Zones in the same Region is charged in both directions for each metered resource. Some services do not charge for in-Region traffic, so check the service's pricing page.

Between Regions, the charge is on the data leaving the source Region. Data arriving in the destination Region has no charge.

Where the exam catches people

  • Believing an S3 interface endpoint is the cheapest fix for NAT charges: for in-VPC traffic in the same Region, the gateway endpoint does it with no additional charge.
  • Believing a gateway endpoint serves on-premises or transit gateway traffic: it only serves subnets in its own VPC whose route tables are associated with it.
  • Believing one central NAT gateway is the cheapest design: traffic from other zones adds inter-AZ charges on top of NAT processing.
  • Believing a gateway endpoint covers S3 in other Regions: prefix lists are per Region, so traffic to another Region's S3 still uses the default route.

Written from Amazon Web Services's documentation

Try 3 questions on this

Pick an answer to see why each option is right or wrong.

  1. Batch jobs in private subnets read tens of terabytes a month from Amazon S3 in the same Region, and the bill is dominated by NAT gateway data processing. The team wants that charge removed. A colleague proposes an interface endpoint for Amazon S3, noting that Amazon S3 supports one. Which solution meets these requirements?

    Right. In the game that’s Renown for your Design Cost-Optimized Architectures building.

    Not that one: D is right. In the game your Design Cost-Optimized Architectures building would lose a little Renown, and this question would come back later.

  2. A VPC has private subnets in three Availability Zones, all routed to a single NAT gateway in one Availability Zone. A solutions architect is asked to reduce the blast radius of an Availability Zone failure for outbound traffic, and the company will accept a higher hourly charge to do it. Which approach will meet these requirements?

    Right. In the game that’s Renown for your Design Cost-Optimized Architectures building.

    Not that one: B is right. In the game your Design Cost-Optimized Architectures building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    "if the instances in the private subnet in Availability Zone A also need to reach the internet, you can create a route from this subnet to the NAT gateway in Availability Zone B. Alternatively, you can improve resiliency by creating a NAT gateway in each Availability Zone that contains resources that require internet access." The single shared gateway is the first arrangement: it works, and it makes every zone's egress depend on one zone. Per-zone gateways remove that dependency, and the stem has already accepted the extra hourly cost.

    Written from docs.aws.amazon.com/vpc/latest/userguide/nat-gateway-scenarios.html

  3. A company's 12 spoke VPCs reach the internet through NAT gateways in a central egress VPC over a transit gateway. Instances in the spokes move about 200 TB a month to and from Amazon S3 and Amazon DynamoDB in the same Region, all along that path. The company must remove the NAT gateway and transit gateway processing charges on this traffic without adding any hourly charges. Which combination of steps should a solutions architect take to meet these requirements? (Select TWO.)

    Right. In the game that’s Renown for your Design Cost-Optimized Architectures building.

    Not that one: D,E is right. In the game your Design Cost-Optimized Architectures building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    "With a gateway endpoint, you can access Amazon S3 from your VPC, without requiring an internet gateway or NAT device for your VPC, and with no additional cost. However, gateway endpoints do not allow access from on-premises networks, from peered VPCs in other AWS Regions, or through a transit gateway." That last clause is what beats A. The DynamoDB page gives the same terms for E. With only D, the DynamoDB traffic keeps paying; with only E, the S3 traffic does.

    Written from docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html