AWS Billing & Cost Management
Table of contents
- Overview
- How AWS Billing Works
- Common Costly Mistakes
- Best Practices to Avoid Unexpected Bills
- How to Check Your Current AWS Charges
- How to Stop/Terminate Resources
- Understanding Your AWS Bill
- Emergency: How to Shut Down Everything
- Financial Assistance and Billing Issues
- Student AWS Credits
- Useful AWS CLI Commands
- Additional Resources
- Summary Checklist
Overview
Amazon Web Services (AWS) operates on a pay-as-you-go pricing model. This means you only pay for the services you use, with no upfront costs or long-term commitments. While this flexibility is powerful, it also means that services left running will continue to accumulate charges.
If you forget to stop or terminate AWS services when you're done using them, you could be charged HUNDREDS or even THOUSANDS of dollars. AWS will bill you for every hour your resources run, and these charges can add up extremely quickly.
ALWAYS stop, terminate, or delete services immediately after you finish using them!
How AWS Billing Works
Pay-As-You-Go Model
AWS charges are based on:
- Compute Time: How long your EC2 instances, Lambda functions, or other compute resources run
- Storage Used: Amount of data stored in S3, EBS volumes, databases, etc.
- Data Transfer: Data transferred out of AWS to the internet
- Requests: Number of API calls, database queries, or function invocations
- Additional Services: Load balancers, elastic IPs, snapshots, and more
Billing Cycle
- AWS bills monthly in arrears (at the end of the billing period)
- Charges are calculated hourly or per-second depending on the service
- Your credit card will be charged automatically at the end of each billing cycle
- You can view current month charges in real-time (with a ~24 hour delay)
Free Tier
AWS offers a Free Tier for new accounts:
- 12 months free: Certain services like 750 hours/month of t2.micro or t3.micro EC2 instances
- Always free: Limited usage of services like Lambda (1M requests/month), DynamoDB (25 GB storage)
- Free trials: Short-term free access to specific services
Important: Free Tier has strict limits. Exceeding these limits will result in charges.
Common Costly Mistakes
1. Leaving EC2 Instances Running
Problem: EC2 instances charge by the hour/second, even when idle.
Example Cost:
t3.mediuminstance: ~$0.04/hour = $30/montht3.largeinstance: ~$0.08/hour = $60/monthc5.xlargeinstance: ~$0.17/hour = $125/monthg4dn.xlarge(GPU): ~$0.50/hour = $370/month
đź’¸ Leaving a single GPU instance running for a month could cost $370+!
đź’¸ Leaving multiple instances running could easily exceed $1,000+/month!
Solution:
- Stop instances when not in use (you still pay for storage but not compute)
- Terminate instances when completely done with them
2. Forgetting About EBS Volumes
Problem: EBS volumes (storage attached to EC2) continue to incur charges even after you terminate an instance if not deleted.
Example Cost:
- 100 GB volume: ~$10/month
- 1 TB volume: ~$100/month
Solution:
- Delete EBS volumes when terminating instances
- Enable “Delete on Termination” when creating instances
3. Unused Elastic IPs
Problem: Elastic IPs (static IP addresses) are free when attached to a running instance, but cost $0.005/hour (~$3.60/month) when not in use.
Solution: Release Elastic IPs you’re not using
4. RDS Databases Left Running
Problem: RDS database instances run 24/7 and can be very expensive.
Example Cost:
db.t3.micro: ~$0.017/hour = $12.50/monthdb.t3.medium: ~$0.068/hour = $50/monthdb.r5.large: ~$0.24/hour = $175/month
Solution:
- Stop RDS instances when not needed (can stay stopped for up to 7 days)
- Take snapshots and delete the instance if not using for extended periods
5. Large Data Transfer Costs
Problem: Data transferred OUT of AWS to the internet is charged (first 1 GB/month is free, then ~$0.09/GB).
Example: Accidentally exposing a public S3 bucket that gets downloaded could cost hundreds or thousands of dollars.
Solution:
- Use private S3 buckets
- Monitor data transfer
- Set up billing alerts
6. NAT Gateway Charges
Problem: NAT Gateways cost ~$0.045/hour ($33/month) plus data processing fees.
Solution: Delete NAT Gateways when not needed, especially in lab environments
Best Practices to Avoid Unexpected Bills
1. Set Up Billing Alerts
Immediately after creating your AWS account:
- Go to AWS Billing Dashboard
- Navigate to Billing Preferences
- Enable “Receive Billing Alerts”
- Go to CloudWatch and create alarms:
- Alert when estimated charges exceed $5
- Alert when estimated charges exceed $10
- Alert when estimated charges exceed $25
2. Use AWS Budgets
- Go to AWS Budgets in the Billing console
- Create a Zero Spend Budget or set a low threshold ($10-20)
- Configure email alerts when you approach or exceed your budget
3. Check Your Bill Regularly
- Review your AWS Cost Explorer weekly
- Check the Bills page to see current month charges
- Look for unexpected services or high costs
4. Enable Cost Allocation Tags
- Tag all resources with your name, project, or purpose
- Use Cost Allocation Tags to track spending by category
- Makes it easier to identify what’s costing money
5. Clean Up After Every Lab/Project
Create a shutdown checklist:
- Stop or terminate all EC2 instances
- Delete unused EBS volumes and snapshots
- Release Elastic IP addresses
- Stop or delete RDS databases
- Delete NAT Gateways and Load Balancers
- Empty and delete S3 buckets (if not needed)
- Delete CloudFormation stacks
- Remove unused security groups and network resources
6. Use Instance Scheduler
- Use AWS Instance Scheduler or EventBridge rules to automatically stop instances on a schedule
- Example: Stop instances every night at midnight, start at 8 AM
7. Set Up Auto-Shutdown
For EC2 instances, you can:
- Use AWS Lambda functions to automatically stop instances after hours
- Set up tag-based automation (e.g., auto-stop instances tagged with “dev” or “lab”)
How to Check Your Current AWS Charges
Method 1: Billing Dashboard
- Sign in to AWS Console
- Click your account name → Billing Dashboard
- View Month-to-Date Spending
- Check Service by Service Costs
Method 2: AWS CLI
aws ce get-cost-and-usage \
--time-period Start=2026-01-01,End=2026-01-15 \
--granularity DAILY \
--metrics BlendedCost
Method 3: Cost Explorer
- Go to Cost Explorer in Billing console
- View daily or monthly cost breakdowns
- Filter by service, region, or tags
How to Stop/Terminate Resources
EC2 Instances
Stop (preserves instance, stops compute charges):
aws ec2 stop-instances --instance-ids i-1234567890abcdef0
Terminate (deletes instance completely):
aws ec2 terminate-instances --instance-ids i-1234567890abcdef0
Console:
- Go to EC2 Dashboard
- Select instance(s)
- Instance State → Stop or Terminate
RDS Databases
Stop (can be stopped for up to 7 days):
- Go to RDS Dashboard
- Select database
- Actions → Stop
Delete:
- Go to RDS Dashboard
- Select database
- Actions → Delete
- Optionally create final snapshot
S3 Buckets
- Go to S3 Dashboard
- Select bucket
- Click Empty to delete all objects
- Click Delete to remove the bucket
EBS Volumes
- Go to EC2 → Volumes
- Select unused volumes
- Actions → Delete Volume
Understanding Your AWS Bill
Bill Components
Your AWS bill includes:
- Service charges: Listed by service (EC2, S3, RDS, etc.)
- Region-specific charges: Costs may vary by region
- Free Tier usage: Shows what’s covered under Free Tier
- Tax: Applied based on your location
Reading the Bill
- Invoice Summary: Total charges for the month
- Charges by Service: Breakdown of each service used
- Free Tier Usage: What’s covered vs. what you’re paying for
- Credits: Any promotional credits applied
Emergency: How to Shut Down Everything
If you see unexpected charges and need to stop everything immediately:
Quick Shutdown Steps
- EC2: Go to EC2 Dashboard → Running Instances → Select All → Terminate
- RDS: Go to RDS → Databases → Select All → Stop or Delete
- Elastic Beanstalk: Go to Elastic Beanstalk → Environments → Terminate
- CloudFormation: Go to CloudFormation → Stacks → Delete
- Lambda: Go to Lambda → Functions → Delete (usually low cost)
- S3: Empty and delete buckets with large storage
- NAT Gateway: Go to VPC → NAT Gateways → Delete
- Elastic IPs: Go to EC2 → Elastic IPs → Release
Use AWS Nuke (Advanced)
For complete cleanup, you can use tools like aws-nuke (third-party) to delete all resources in your account. Use with extreme caution!
Financial Assistance and Billing Issues
If You Get an Unexpected Bill
- Contact AWS Support immediately:
- Go to Support Center
- Create a billing support case
- Explain the situation (student, forgot to shut down, etc.)
- Request Credit:
- AWS may issue a one-time credit for honest mistakes
- Be polite and explain you’re a student learning
- This typically only works once
- Payment Plans:
- Contact AWS billing to discuss payment options
- They may be able to work with you on large unexpected bills
Prevention is Key
🚨 The best way to avoid financial disaster is to ALWAYS shut down services immediately after use. Set calendar reminders, use billing alerts, and check your bill weekly. Don't rely on AWS to warn you — by the time you notice, you could owe hundreds or thousands of dollars.
Student AWS Credits
If your course provides AWS credits:
- AWS Educate: Provides $50-100 in credits for students
- AWS Academy: Provides limited credits for course labs
- GitHub Student Developer Pack: May include AWS credits
Important: Credits don’t make you immune to charges. If you exceed your credits, you’ll be charged real money.
Useful AWS CLI Commands
List Running EC2 Instances
aws ec2 describe-instances \
--filters "Name=instance-state-name,Values=running" \
--query "Reservations[*].Instances[*].[InstanceId,InstanceType,State.Name]" \
--output table
Stop All Running Instances
aws ec2 stop-instances \
--instance-ids $(aws ec2 describe-instances \
--filters "Name=instance-state-name,Values=running" \
--query "Reservations[*].Instances[*].InstanceId" \
--output text)
List All EBS Volumes
aws ec2 describe-volumes \
--query "Volumes[*].[VolumeId,Size,State]" \
--output table
Check Estimated Charges
aws cloudwatch get-metric-statistics \
--namespace AWS/Billing \
--metric-name EstimatedCharges \
--dimensions Name=Currency,Value=USD \
--start-time $(date -u -d '1 day ago' +%Y-%m-%dT%H:%M:%S) \
--end-time $(date -u +%Y-%m-%dT%H:%M:%S) \
--period 86400 \
--statistics Maximum
Additional Resources
- AWS Pricing Calculator - Estimate costs before deploying
- AWS Free Tier - Understand what’s free
- AWS Cost Optimization - Best practices
- AWS Billing Documentation - Official docs
- AWS Support Center - Get help with billing issues
Summary Checklist
Before you finish any AWS lab or project:
âś… Stop or terminate all EC2 instances
âś… Delete unused EBS volumes
âś… Release Elastic IP addresses
âś… Stop or delete RDS databases
âś… Delete NAT Gateways
âś… Empty and delete unnecessary S3 buckets
âś… Delete CloudFormation stacks
âś… Check your billing dashboard
âś… Verify no unexpected charges
⚠️ REMEMBER: When in doubt, SHUT IT DOWN! ⚠️
A few extra minutes to clean up can save you thousands of dollars.
Last updated: January 2026