Link Search Menu Expand Document

AWS Billing & Cost Management

Table of contents

  1. Overview
  2. How AWS Billing Works
    1. Pay-As-You-Go Model
    2. Billing Cycle
    3. Free Tier
  3. Common Costly Mistakes
    1. 1. Leaving EC2 Instances Running
    2. 2. Forgetting About EBS Volumes
    3. 3. Unused Elastic IPs
    4. 4. RDS Databases Left Running
    5. 5. Large Data Transfer Costs
    6. 6. NAT Gateway Charges
  4. Best Practices to Avoid Unexpected Bills
    1. 1. Set Up Billing Alerts
    2. 2. Use AWS Budgets
    3. 3. Check Your Bill Regularly
    4. 4. Enable Cost Allocation Tags
    5. 5. Clean Up After Every Lab/Project
    6. 6. Use Instance Scheduler
    7. 7. Set Up Auto-Shutdown
  5. How to Check Your Current AWS Charges
    1. Method 1: Billing Dashboard
    2. Method 2: AWS CLI
    3. Method 3: Cost Explorer
  6. How to Stop/Terminate Resources
    1. EC2 Instances
    2. RDS Databases
    3. S3 Buckets
    4. EBS Volumes
  7. Understanding Your AWS Bill
    1. Bill Components
    2. Reading the Bill
  8. Emergency: How to Shut Down Everything
    1. Quick Shutdown Steps
    2. Use AWS Nuke (Advanced)
  9. Financial Assistance and Billing Issues
    1. If You Get an Unexpected Bill
    2. Prevention is Key
  10. Student AWS Credits
  11. Useful AWS CLI Commands
    1. List Running EC2 Instances
    2. Stop All Running Instances
    3. List All EBS Volumes
    4. Check Estimated Charges
  12. Additional Resources
  13. 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.

⚠️ CRITICAL WARNING ⚠️

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.medium instance: ~$0.04/hour = $30/month
  • t3.large instance: ~$0.08/hour = $60/month
  • c5.xlarge instance: ~$0.17/hour = $125/month
  • g4dn.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/month
  • db.t3.medium: ~$0.068/hour = $50/month
  • db.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:

  1. Go to AWS Billing Dashboard
  2. Navigate to Billing Preferences
  3. Enable “Receive Billing Alerts”
  4. 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

  1. Go to AWS Budgets in the Billing console
  2. Create a Zero Spend Budget or set a low threshold ($10-20)
  3. 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

  1. Sign in to AWS Console
  2. Click your account name → Billing Dashboard
  3. View Month-to-Date Spending
  4. 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

  1. Go to Cost Explorer in Billing console
  2. View daily or monthly cost breakdowns
  3. 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:

  1. Go to EC2 Dashboard
  2. Select instance(s)
  3. Instance State → Stop or Terminate

RDS Databases

Stop (can be stopped for up to 7 days):

  1. Go to RDS Dashboard
  2. Select database
  3. Actions → Stop

Delete:

  1. Go to RDS Dashboard
  2. Select database
  3. Actions → Delete
  4. Optionally create final snapshot

S3 Buckets

  1. Go to S3 Dashboard
  2. Select bucket
  3. Click Empty to delete all objects
  4. Click Delete to remove the bucket

EBS Volumes

  1. Go to EC2 → Volumes
  2. Select unused volumes
  3. 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

  1. EC2: Go to EC2 Dashboard → Running Instances → Select All → Terminate
  2. RDS: Go to RDS → Databases → Select All → Stop or Delete
  3. Elastic Beanstalk: Go to Elastic Beanstalk → Environments → Terminate
  4. CloudFormation: Go to CloudFormation → Stacks → Delete
  5. Lambda: Go to Lambda → Functions → Delete (usually low cost)
  6. S3: Empty and delete buckets with large storage
  7. NAT Gateway: Go to VPC → NAT Gateways → Delete
  8. 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

  1. Contact AWS Support immediately:
    • Go to Support Center
    • Create a billing support case
    • Explain the situation (student, forgot to shut down, etc.)
  2. 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
  3. 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

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


^
TOP

Copyright @ 2025 CityU STC