SimAWSby ShahriarLabs
Search

How the bill is actually calculated · Chapter 1 of 2

How your monthly AWS bill is calculated

AWS charges for resources using four basic vectors — compute time, storage volume, request count, and data transfer — creating bills that accumulate even when servers are idle.

FoundationsBuilds the idea from nothing. No prior AWS assumed.

The four things you pay for

Why does an idle AWS account still generate a bill at the end of the month?

VPC 10.0.0.0/16Private EC210.0.1.50NAT Gateway0.045$/hr + 0.045$/GBS3 BucketPublic EndpointNAT Gateways charge hourly runtime fees plus data processing charges per GB, making direct service endpoints significantly cheaper.

Private subnet instances route external requests to S3 through the NAT Gateway.

1/4
  1. 01

    Compute time is billed by the second

    Virtual servers and functions charge for the time they run. If you launch an EC2 instance and leave it running for 730 hours in a month, you are billed for every second of that time, regardless of whether any users visit your website. Compute is a rental of raw CPU and memory capacity.

  2. 02

    Storage is billed by the gigabyte-month

    Storing files or database backups costs money for as long as those bytes occupy physical disks. AWS charges a monthly rate per gigabyte of allocated storage. This means a 100 GB database disk will cost the same amount whether the database engine is running, stopped, or completely idle.

  3. 03

    Requests and data transfer out

    Services often charge for the volume of actions performed, such as reading an object from S3. Additionally, you are billed for data transfer out of the AWS network to the internet. While sending data into AWS is free, sending data out to users is a major component of overall cloud spend.

Check yourself

You stop a virtual server (EC2 instance) so that it is no longer running. Which resource continues to accumulate charges?

Under the hoodThe same thing from underneath: limits, failure modes, numbers.

The mechanics of pricing pages

How do you calculate the actual cost of a complex cloud resource from its pricing page?

VPC 10.0.0.0/16Private EC210.0.1.50NAT Gateway0.045$/hr + 0.045$/GBS3 BucketPublic EndpointNAT Gateways charge hourly runtime fees plus data processing charges per GB, making direct service endpoints significantly cheaper.

Private subnet instances route external requests to S3 through the NAT Gateway.

1/4
  1. 01

    Decoding dual-charge resources

    Some resources charge along two vectors simultaneously. A NAT Gateway charges a flat hourly rate to exist, plus a per-gigabyte rate for all data passing through it. If you deploy a NAT Gateway across three Availability Zones to ensure reliability, you pay three times the hourly fee even with zero traffic.

  2. 02

    The cost of reserving public IPs

    IPv4 addresses are scarce. To prevent waste, AWS charges an hourly fee for every Elastic IP address allocated to your account. If the IP address is attached to a running instance, the fee is sometimes waived, but if the instance is stopped or the IP is unattached, you are billed the full rate.

  3. 03

    Free tier limits and pitfalls

    The AWS Free Tier covers many services for the first 12 months, but it has strict usage thresholds. If you launch a database that exceeds the free tier size, or run two micro-instances instead of one, you will exceed the monthly hour limit. The system will start billing your credit card immediately.

The numbers

NAT Gateway base rate
$0.045 per hourRunning one NAT Gateway for a full 730-hour month costs $32.85 before any data is transferred.
NAT Gateway data processing charge
$0.045 per GBProcessing 1 TB of data through a NAT Gateway adds $46.08 to the monthly bill.
Idle Elastic IP charge
$0.005 per hourAn unused public IPv4 address left allocated in your account costs $3.65 per month.
EBS General Purpose SSD storage cost
$0.08 per GB-monthAllocating a 100 GB virtual disk costs $8.00 per month, whether the virtual server is running or stopped.

Check yourself

You allocate three Elastic IP addresses but do not attach them to any running resources. What is the approximate cost of leaving them idle for a 30-day month?

Official references & further reading

These lessons simplify selected behaviors for learning. Verify current service limits, Region support and production requirements with the official references. Experiments describe their own assumptions.

Report an error or suggest a clearer explanation →