AWSAmazon VPCNetworking

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_subnet is a range of IP addresses inside a VPC, pinned to a single Availability Zone. Public subnets route to an internet gateway; private subnets route outbound through a NAT Gateway. Creating subnets, public or private, is free. There is no per-subnet charge and no charge for the number you carve out of a VPC.

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_subnet.

DimensionUnitWhat's being charged
SubnetfreeThe subnet, its CIDR range, and route table association have no charge.
$0
Cross-AZ data transferper GBTraffic between subnets in different Availability Zones is billed both ways.
$0.01/GB each direction
NAT Gateway for private subnetsper hour + per GBPrivate 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_subnet cost without changing the workload.

Colocate chatty tiers in one AZ

Removes cross-AZ transfer on that path

Cross-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 avoided

Route 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

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_subnet.