What you will learn
- How AWS bills you and where most teams waste money without knowing it
- Cost Explorer — how to drill into your bill and find what is costing most
- The difference between Savings Plans and Reserved Instances
- Compute Savings Plans vs EC2 Instance Savings Plans — which is more flexible
- Cost Anomaly Detection — ML that spots unexpected spending automatically
- AWS Budgets — set limits and get alerted before bills surprise you
- Networking costs — the rules that catch every team eventually
- Instance Scheduler — turning off non-production resources overnight
- Trusted Advisor — the free account health scanner
Why this matters
A Razorpay engineering team doubled their EC2 fleet during a load test and forgot to scale back down. Three weeks later their AWS bill was double the usual amount and nobody noticed until the invoice arrived. At a Mumbai startup, NAT Gateway charges were higher than the EC2 bill because all S3 traffic was routing through NAT instead of a free VPC Endpoint. At Zerodha, switching idle development instances from On-Demand to Savings Plans cut their compute bill by 40% overnight. AWS costs are invisible until you look. And by the time you look, you have often been overpaying for weeks.
How AWS Bills You
AWS billing has four components:
Compute: EC2 hours, Lambda invocations, ECS task secondsStorage: S3 GB-months, EBS GB-months, Snapshot GB-monthsData transfer: Outbound to internet, cross-AZ, cross-regionRequests: API calls, S3 GET/PUT requests, KMS operationsThe costs that surprise teams most are not compute — they are data transfer. Traffic leaving AWS to the internet, traffic crossing Availability Zones, and NAT Gateway processing fees accumulate silently.
Free data transfer (zero cost):
Traffic coming INTO AWS from internet → always freeTraffic between services in the SAME AZ → free (use private IPs)Traffic to S3 or DynamoDB via VPC Gateway Endpoint → freeCharged data transfer:
Traffic leaving AWS to the internet → $0.085-0.09 per GBTraffic crossing Availability Zones → $0.01 per GB each directionNAT Gateway processing → $0.045 per GBCross-region traffic → $0.02 per GBRememberTraffic between services in the same AZ using private IPs is free. The same traffic using public IPs costs money — even within the same region. Always use private IPs for internal communication.
AWS Cost Explorer
Cost Explorer is the primary tool for understanding your AWS bill. It gives you charts, filters, and forecasts across any time range.
What you can do:
View costs by: Service → EC2 is costing X, RDS is costing Y, NAT Gateway is Z Region → ap-south-1 vs us-east-1 breakdown Account → per account in your Organisation Tag → per team, per project, per environment Instance type → which EC2 types are most expensive Filter to: Last 3 months of EC2 costs in ap-south-1 only This month's costs for resources tagged Environment=prod RDS costs across all regions Forecast: Based on current usage, predict next 12 months of spend Identify trend before it becomes a surpriseResource-level granularity:
Cost Explorer can show costs per individual EC2 instance — not just per service. Identify the single most expensive instance in your account. Identify instances running 24/7 that are only used during business hours.
Rightsizing recommendations:
Cost Explorer analyses your EC2 usage and recommends cheaper instance types that can handle your actual workload. If your m5.xlarge is consistently at 8% CPU, Cost Explorer suggests t3.large which costs 60% less.
AWS Budgets — Know Before You Are Surprised
Budgets send alerts when costs exceed a threshold you define.
Budget: monthly EC2 spend > $500Alert at 80%: "you have spent $400 this month on EC2"Alert at 100%: "you have spent $500 — budget reached"Alert at 110%: "you have exceeded budget — spending $550"Budget types:
| Type | What it tracks |
|---|---|
| Cost budget | Total spend in dollars |
| Usage budget | Amount of a specific service used (EC2 hours, S3 GB) |
| Savings Plans budget | Coverage or utilisation percentage |
| Reservation budget | RI coverage or utilisation |
Best practice: set one account-level monthly budget and one per-service budget for your top 3 most expensive services. Alert at 80% and 100%.
Savings Plans — Commit to Save
On-Demand EC2 is the most expensive pricing option. You pay full price for every hour. Savings Plans offer up to 72% discount in exchange for committing to a minimum spend for 1 or 3 years.
How it works:
You commit: "I will spend at least $10/hour on AWS compute for 3 years"AWS gives you: up to 72% discount on that computeUsage above $10/hour → charged at On-Demand ratesTwo types of Savings Plans:
Compute Savings Plans — maximum flexibility:
Applies to: EC2 (any instance family, any region, any OS), Lambda, FargateChange instance family: t3 → m5 → c6i → discount still appliesChange region: ap-south-1 → us-east-1 → discount still appliesDiscount: up to 66%EC2 Instance Savings Plans — deeper discount, less flexibility:
Applies to: one specific instance family in one specific regionExample: commit to m5 in ap-south-1 onlyCannot switch family or region — discount lostDiscount: up to 72%Savings Plans vs Reserved Instances:
| Savings Plans | Reserved Instances | |
|---|---|---|
| Commitment | Dollar amount per hour | Specific instance type |
| Flexibility | High (Compute SP) or medium (EC2 SP) | Low — locked to type |
| Management | Automatic — applies to matching usage | Manual — must assign |
| Best for | Most teams — simpler to manage | Predictable, unchanging workloads |
TipStart with Compute Savings Plans. They are more flexible — if you change instance types or regions, the discount moves with you. EC2 Instance Savings Plans give a slightly higher discount but lock you to a specific family and region. For most teams the flexibility of Compute Savings Plans is worth the small discount difference.
Cost Anomaly Detection
Cost Anomaly Detection uses machine learning to learn your normal spending patterns and alert you when something unusual happens — before you see it on your monthly invoice.
AWS learns your normal baseline: EC2 usually costs $200-220/day RDS usually costs $80-90/day Thursday: EC2 costs $800→ Anomaly detected→ Alert sent immediately: "EC2 spend 4x higher than expected in ap-south-1" You investigate: a developer left a p3.8xlarge (GPU instance) running overnightWithout anomaly detection: you discover this at month-end when the invoice arrives. With anomaly detection: you get alerted within hours and shut it down.
Setting up:
Cost Management → Cost Anomaly Detection → Create monitorMonitor type: AWS services (monitors each service individually)Alert threshold: $20 anomaly (alert only if unexpected spend exceeds $20)Notification: SNS → your email or SlackNetworking Cost — The Hidden Bill
Networking charges are the most commonly overlooked AWS cost. They accumulate silently and are hard to trace back to the cause.
The most expensive networking mistake:
Private EC2 → NAT Gateway → S3 (paid NAT processing per GB)Fix: Create a free S3 VPC Gateway EndpointPrivate EC2 → VPC Endpoint → S3 (free) For a team storing and reading 10 TB/month in S3:Without endpoint: 10 TB × $0.045 = $450/month in NAT Gateway feesWith endpoint: $0/monthCross-AZ data transfer:
EC2 in ap-south-1a → EC2 in ap-south-1b → $0.01/GB each wayEC2 in ap-south-1a → EC2 in ap-south-1a → free For a high-traffic microservice making 100 GB/day of cross-AZ calls:$0.01 × 100 GB × 2 directions × 30 days = $60/monthFix: deploy interdependent services in the same AZOutbound to internet:
EC2 serving 1 TB/month to internet users → ~$85/month in data transferWith CloudFront in front: CloudFront to internet is cheaper + most served from cacheCache hit rate of 80% → only 200 GB to origin → significant savingsInstance Scheduler — Turn Off What You Do Not Need
Most development, staging, and test environments only need to run during business hours. Leaving them running 24/7 wastes 65% of their cost.
AWS Instance Scheduler is a CloudFormation solution that automatically starts and stops EC2 and RDS instances on a schedule.
Dev EC2 instances: Start: Monday-Friday 8 AM IST Stop: Monday-Friday 10 PM IST Weekend: off entirely Result: instead of 720 hours/month → 280 hours/monthCost reduction: 61%Deploy it: AWS Solutions Library → "Instance Scheduler on AWS" → Launch CloudFormation stack Set schedule tags on your instances → scheduler handles the rest
Hands-on Lab — Cost Explorer, Budget, and Anomaly Detection
Step 1 — Explore your current costs
AWS Console → Cost Management → Cost Explorer → Launch Cost Explorer View: Monthly costs by service (last 3 months)Which service costs most? Note the amounts. Filter: Service = EC2 Time = last 30 daysGroup by: Instance typeWhich instance types are you spending most on? Filter: Service = Data TransferThis shows all data transfer charges — often a surprise.Step 2 — Find rightsizing opportunities
Cost Explorer → Rightsizing recommendationsReview instances flagged as over-provisionedCheck: what is the recommended instance type and projected savings?Step 3 — Create a monthly budget
Cost Management → Budgets → Create budgetBudget type: Cost budgetPeriod: MonthlyBudget amount: $100 (adjust to your actual spend) Alerts:Add alert → threshold 80% → email notificationAdd alert → threshold 100% → email notification Create budget Now you will get an email if spending approaches or exceeds $100/month.Step 4 — Enable Cost Anomaly Detection
Cost Management → Cost Anomaly Detection → Create monitorMonitor name: all-services-monitorMonitor type: AWS servicesCreate monitor Create alert subscription:Alert name: daily-anomaly-alertThreshold: individual alert → $10 impact (alert on any anomaly above $10)Notification: email → your emailCreate subscriptionStep 5 — Check Savings Plans recommendations
Cost Management → Savings Plans → RecommendationsTerm: 1 year Payment: No upfrontSee recommended commitment amount and projected savings If you have stable compute usage, this shows how much you could save.For a lab account this may show $0 — that is normal with low usage.Step 6 — Verify you have S3 VPC Endpoint (free cost saving)
VPC → Endpoints → filter by Service Name containing s3If no S3 Gateway Endpoint exists → create one (it is free)All S3 traffic from private subnets now bypasses NAT GatewayCommon Mistakes to Avoid
Common MistakeRouting S3 traffic through NAT Gateway. NAT Gateway charges $0.045 per GB processed. S3 VPC Gateway Endpoints are completely free. For any team storing or reading meaningful amounts of data from S3, creating the Gateway Endpoint takes 2 minutes and can save hundreds of dollars per month.
Common MistakeLeaving development and staging EC2 instances running 24/7. These environments are typically only used during business hours. Deploy Instance Scheduler and recover 60%+ of their cost immediately. It takes one CloudFormation stack and a few tags.
Common MistakeNot setting AWS Budgets until after the first surprise invoice. Budgets are free to create. Set them on day one. An 80% alert gives you time to investigate before reaching your limit. A 100% alert means you are already over — but at least you know immediately instead of at month end.
TipTag everything from day one — every EC2, RDS, S3 bucket, NAT Gateway. Use consistent tags: Environment (dev/staging/prod), Team (backend/frontend/data), Project. Without tags, Cost Explorer shows you what you are spending but cannot tell you why or who owns it. With tags you can give each team their exact AWS bill.