Catalog My learning Blog
AWS Tutorial for Developers: From Account to Production · Phase 1 · Lesson 5 · 3 min read

AWS Pricing Explained and Cost Management

On this page
  1. Why AWS bills surprise people
  2. What AWS charges for
  3. On-Demand vs Savings Plans vs Reserved vs Spot
  4. Cost Explorer, tags and anomaly detection
  5. Creating an AWS budget alert
  6. Check yourself

Why AWS bills surprise people

A developer tries a managed service on a Friday, forgets about it, and the bill arrives a month later. Or a project's data transfer quietly grows until it costs more than its servers. AWS pricing isn't hard, but it has a lot of meters running at once, and some of them aren't obvious.

What AWS charges for

Almost every charge falls into four buckets:

  • Compute time: per second or hour for instances, containers, databases; per request and duration for Lambda.
  • Storage: per GB-month (S3, EBS volumes, snapshots, backups).
  • Requests and operations: S3 requests, DynamoDB reads and writes, API Gateway calls.
  • Data transfer: data into AWS is free; data out to the internet costs per GB, and so does traffic between regions and, in smaller amounts, between Availability Zones.

Some charges people miss: NAT gateways (per hour and per GB processed), public IPv4 addresses (charged hourly since 2024, attached or not), idle load balancers, old snapshots, and CloudWatch Logs ingestion.

On-Demand vs Savings Plans vs Reserved vs Spot

ModelDiscount vs On-DemandCommitmentBest for
On-DemandNoneNoneUnpredictable or short-lived workloads, new projects
Savings PlansUp to about 66 to 72 percentA dollar amount per hour for 1 or 3 yearsSteady baseline usage; Compute Savings Plans also cover Fargate and Lambda
Reserved InstancesSimilar to Savings PlansA specific instance type or database for 1 or 3 yearsRDS, ElastiCache, OpenSearch, where Savings Plans don't apply
Spot InstancesUp to about 90 percentNone, but AWS can reclaim with 2 minutes' noticeFault-tolerant batch jobs, CI runners, stateless workers
On-Demand suits unpredictable use, commitments suit a steady baseline, and Spot suits work that can be interrupted.
On-Demand suits unpredictable use, commitments suit a steady baseline, and Spot suits work that can be interrupted.

The usual pattern: cover the stable baseline with Savings Plans, run the variable part On-Demand, and push interruptible work to Spot. Commit only after rightsizing (Day 28); committing to oversized instances locks in waste.

Cost Explorer, tags and anomaly detection

  • Cost Explorer shows spend by service, account, region and tag, with forecasts.
  • Cost allocation tags (like Project and Environment) let you split the bill by team. Activate them in the billing console; they only apply from then on.
  • The Cost and Usage Report (CUR) exports every line item for detailed analysis.
  • Cost Anomaly Detection alerts on unusual spikes.
  • New accounts get AWS Free Tier credits and always-free allowances for some services; check what's covered before relying on it.

Creating an AWS budget alert

A monthly budget for one project, alerting when the forecast passes 80 percent, so you hear about it before the money is spent (run against a local AWS emulator):

Shell
aws budgets create-budget \
  --account-id 123456789012 \
  --budget '{
    "BudgetName": "project-atlas-monthly",
    "BudgetLimit": {"Amount": "5000", "Unit": "USD"},
    "TimeUnit": "MONTHLY",
    "BudgetType": "COST",
    "CostFilters": {"TagKeyValue": ["user:Project$atlas"]}
  }' \
  --notifications-with-subscribers '[{
    "Notification": {
      "NotificationType": "FORECASTED",
      "ComparisonOperator": "GREATER_THAN",
      "Threshold": 80,
      "ThresholdType": "PERCENTAGE"
    },
    "Subscribers": [{"SubscriptionType": "EMAIL", "Address": "team-atlas@example.com"}]
  }]'

The tag filter format is user:<TagKey>$<value>, and it only works once Project is an activated cost allocation tag. Budgets alert; they don't stop spending. To act automatically, add budget actions (for example, apply a restrictive policy), or have the SNS notification trigger a Lambda.

Check yourself

Data into AWS is free; data out to the internet, between regions, and (at a lower rate) between Availability Zones is charged.

A Savings Plan commits you to a level of spend for one or three years. Committing while instances are oversized guarantees paying for that waste for the whole term; shrink first, then commit to the smaller baseline.

For workloads that can't tolerate interruption, such as a single stateful database, since AWS can reclaim Spot capacity with two minutes' notice.

Tags like team, environment and application let Cost Explorer break the bill down by owner. Without them, finding who owns a cost later is slow guesswork.

It learns your normal spending patterns and alerts you when costs for a service, account or tag rise unexpectedly, catching runaway resources within a day instead of at month end.