aws_ subnet cost estimation
A subnet is free. It carves an IP range out of a VPC in one Availability Zone, and AWS charges nothing for it. Cost comes from the resources you place in it and the traffic they generate.
An aws_
The cost tied to a subnet is indirect but real. First, the paid resources you launch into it: EC2 instances, RDS databases, load balancer nodes, and their EBS or storage. Second, and easy to miss, is the Availability Zone boundary the subnet defines. Traffic between resources in subnets in different AZs is billed as cross-AZ data transfer at about $0.01/GB in each direction, so a chatty app split across a subnet in us-east-1a and a subnet in us-east-1b pays a per-GB tax that a single-AZ layout would not. Private subnets also imply a NAT Gateway for outbound internet, which runs about $0.045/hour plus $0.045/GB processed.
The design decisions that matter are how many AZs you spread subnets across (availability versus cross-AZ transfer), and whether private subnets share one NAT Gateway or run one per AZ. c3x prices the instances, databases, and NAT Gateways in each subnet and correctly treats the subnet itself as free scaffolding.
Terraform example
A minimal but realistic configuration that C3X can estimate.
resource "aws_subnet" "private" {
vpc_id = aws_vpc.main.id
cidr_block = "10.0.1.0/24"
availability_zone = "us-east-1a"
tags = {
Name = "private-1a"
}
}Pricing dimensions
What you actually pay for when you provision aws_.
| Dimension | Unit | What's being charged |
|---|---|---|
| Subnet | free | The subnet, its CIDR range, and route table association have no charge. $0 |
| Cross-AZ data transfer | per GB | Traffic between subnets in different Availability Zones is billed both ways. $0.01/GB each direction |
| NAT Gateway for private subnets | per hour + per GB | Private subnets route outbound through a NAT Gateway, the usual paid component. ~$0.045/hour + $0.045/GB processed |
Optimization tips
Common ways to reduce aws_ cost without changing the workload.
Colocate chatty tiers in one AZ
Removes cross-AZ transfer on that pathCross-AZ traffic between subnets is billed in both directions. Placing services that talk to each other frequently in the same-AZ subnet removes that per-GB charge.
Share one NAT Gateway across private subnets
~$32/month per gateway avoidedRoute several private subnets through a single NAT Gateway when you can accept the single-AZ dependency, instead of one gateway per subnet.
Add free gateway endpoints
S3 and DynamoDB gateway endpoints let private subnets reach those services without touching the NAT Gateway, cutting the per-GB processing fee.
FAQ
Does an AWS subnet cost money?
No. Subnets are free, whether public or private, and there is no charge for how many you create. You pay only for the resources launched into them and the data transfer they generate.
Why does splitting subnets across AZs cost more?
The subnet itself is still free, but traffic between resources in subnets in different Availability Zones is billed as cross-AZ data transfer at about $0.01/GB each way. A multi-AZ layout trades that cost for higher availability.
Do private subnets cost more than public subnets?
The subnets cost the same, which is nothing. Private subnets usually imply a NAT Gateway for outbound internet, and that gateway is the paid component, not the subnet.
Related resources
More AWS resources
Further reading
- How many NAT gateways do I need? Balancing cost and availability
A NAT gateway costs about 32 to 45 dollars a month plus per-GB processing, and the naive high-availability setup runs one per availability zone. Knowing when you need that redundancy and when one gateway is fine saves real money. Here is the tradeoff.
- Public IPv4 address cost: the charge AWS added to every address
AWS now charges about $0.005 per hour for every public IPv4 address, in use or idle, adding roughly $3.65 per month per address. For fleets with hundreds of public IPs the total is real. Here is how the charge works and how to cut it.
- VPC endpoint vs NAT gateway cost: when the endpoint is free money
Gateway endpoints for S3 and DynamoDB are free and remove that traffic from your NAT gateway entirely. Interface endpoints cost per hour per AZ plus per GB, which can still beat NAT on high-volume paths. Here is how to choose.
- Azure NAT Gateway cost: hourly fee plus per-GB, like AWS
Azure NAT Gateway charges about $0.045 per hour plus about $0.045 per GB processed, the same shape as the AWS NAT gateway. It is often cheaper and simpler than Azure Firewall for outbound-only needs. Here is how it prices and where it fits.
Estimate this resource in your own Terraform
Free, open source, no API key. C3X parses your Terraform and shows line-item cost for every resource, including aws_.