AWS Cheatsheet

Cost and Free Tier

Use this AWS reference while you build software engineering projects, review code for technical interview prep, or polish examples for a software engineer resume.

Free Tier: Two Generations

Account createdWhat you get
On/after July 15, 2025Credit-based Free Plan: $100 in credits at sign-up + up to $100 more for completing onboarding activities (launch an EC2 instance, set a budget, etc.). Runs 6 months or until credits are exhausted, whichever comes first; the account cannot incur charges while on the Free Plan. Upgrade to the Paid Plan to keep resources past that point (remaining credits still apply).
Before July 15, 2025Legacy free tier: 12-month offers from account creation (EC2, S3, RDS, …) plus always-free offers.

Check current entitlements at aws.amazon.com/free

Always-Free Offers (all accounts)

ServiceFree Tier
Lambda1M requests + 400k GB-sec/mo
DynamoDB25 GB storage, 25 WCU, 25 RCU
CloudFront1 TB egress + 10M requests/mo
CloudWatch10 custom metrics, 5 GB log ingestion, 3 dashboards
SNS1M publishes, 100k HTTP deliveries, 1k email/mo
SQS1M requests/mo
Cognito10k MAU (Lite tier)
Data Transfer INAlways free (all services)

No free tier at all: Secrets Manager ($0.40/secret/mo), KMS ($1/key/mo).

Legacy 12-Month Offers (pre-July-2025 accounts only)

ServiceFree Tier
EC2750 hrs/mo t2.micro or t3.micro (Linux/Windows)
S35 GB storage, 20k GET, 2k PUT/mo
RDS750 hrs/mo db.t3.micro or db.t4g.micro, 20 GB SSD, 20 GB backup
API Gateway1M REST API calls/mo

Pricing Model Comparison

ModelBest ForSavings
On-DemandIrregular workloads, spikesBaseline
Savings Plans (Compute)Flexible; applies to EC2/Lambda/FargateUp to 66%
Savings Plans (EC2 Instance)Specific instance family in a regionUp to 72%
Reserved Instances (1yr)Steady-state EC2/RDS, no upfront~40%
Reserved Instances (3yr all-upfront)Long-term stable workloads~60–72%
Spot InstancesFault-tolerant, batch, flexibleUp to 90%
Spot + On-Demand mix (ASG)Balance cost + availability40–70%
FARGATE_SPOTInterruptible container workloads~70%

Data Transfer Pricing (2025 approximate)

TransferPrice
INTO AWS (ingress)Free
EC2/S3 → Internet (first 100 GB/mo)$0.09/GB
EC2/S3 → Internet (next 9.9 TB)$0.085/GB
Between AZs (same region)$0.01/GB each direction
Between regions$0.02–0.08/GB
CloudFront → Internet$0.0075–0.085/GB (tiered, by region)
S3 → CloudFrontFree (origin pull)
Lambda → InternetStandard EC2 rates

Put CloudFront in front of S3 to get free origin transfer and cheaper edge delivery.

Cost Explorer & Billing CLI

# Current month estimated charges
aws ce get-cost-and-usage \
  --time-period Start=$(date -u +%Y-%m-01),End=$(date -u +%Y-%m-%d) \
  --granularity MONTHLY \
  --metrics BlendedCost \
  --query 'ResultsByTime[0].Total.BlendedCost'

# By service (last 30 days)
aws ce get-cost-and-usage \
  --time-period Start=$(date -u -d '-30 days' +%Y-%m-%d),End=$(date -u +%Y-%m-%d) \
  --granularity MONTHLY \
  --metrics BlendedCost \
  --group-by Type=DIMENSION,Key=SERVICE \
  --query 'ResultsByTime[0].Groups[*].[Keys[0],Metrics.BlendedCost.Amount]' \
  --output table

# Forecast next month cost
aws ce get-cost-forecast \
  --time-period Start=$(date -u +%Y-%m-%d),End=$(date -u +%Y-%m-01 -d 'next month') \
  --granularity MONTHLY \
  --metric BLENDED_COST

# View Savings Plans recommendations
aws savingsplans describe-savings-plans-purchase-recommendation \
  --savings-plans-type COMPUTE_SP \
  --term-in-years ONE_YEAR \
  --payment-option NO_UPFRONT \
  --lookback-period-in-days THIRTY_DAYS

Billing Alarms

# Enable billing alerts (once per account, us-east-1)
aws cloudwatch put-metric-alarm \
  --alarm-name billing-alert-50 \
  --alarm-description "Estimated charges > $50" \
  --namespace AWS/Billing \
  --metric-name EstimatedCharges \
  --dimensions Name=Currency,Value=USD \
  --statistic Maximum \
  --period 86400 \
  --threshold 50 \
  --comparison-operator GreaterThanOrEqualToThreshold \
  --evaluation-periods 1 \
  --alarm-actions arn:aws:sns:us-east-1:123:billing-alerts \
  --region us-east-1

The AWS/BillingEstimatedCharges metric only exists after you turn on "Receive Billing Alerts" in the console (Billing → Billing preferences → Alert preferences) — there is no CLI/API for that toggle, and the metric is published to us-east-1 only. AWS Budgets (below) needs no such preference and is the modern default.

Budgets

# Create a $100/mo cost budget with 80% + 100% alerts
aws budgets create-budget \
  --account-id 123456789012 \
  --budget '{
    "BudgetName": "monthly-100",
    "BudgetLimit": {"Amount":"100","Unit":"USD"},
    "TimeUnit": "MONTHLY",
    "BudgetType": "COST"
  }' \
  --notifications-with-subscribers '[
    {
      "Notification": {
        "NotificationType":"ACTUAL",
        "ComparisonOperator":"GREATER_THAN",
        "Threshold":80,
        "ThresholdType":"PERCENTAGE"
      },
      "Subscribers":[{"SubscriptionType":"EMAIL","Address":"you@example.com"}]
    },
    {
      "Notification": {
        "NotificationType":"FORECASTED",
        "ComparisonOperator":"GREATER_THAN",
        "Threshold":100,
        "ThresholdType":"PERCENTAGE"
      },
      "Subscribers":[{"SubscriptionType":"EMAIL","Address":"you@example.com"}]
    }
  ]'

aws budgets describe-budgets --account-id 123456789012

Cost Allocation Tags

# Activate user-defined tag for cost tracking
aws ce update-cost-allocation-tags-status \
  --cost-allocation-tags-status TagKey=Project,Status=Active \
                                TagKey=Env,Status=Active

# Check which tags are active
aws ce list-cost-allocation-tags --status Active

Tag every resource at creation: Environment, Project, Team, CostCenter. Retroactive tagging doesn't backfill history.

Quick Cost-Saving Checks

ActionPotential Savings
Delete unattached EBS volumes$0.08–0.10/GB-mo
Release unattached Elastic IPs$0.005/hr each
Move objects to INTELLIGENT_TIERINGUp to 68% on infrequent objects
Use Savings Plans for steady Lambda/EC240–66%
Enable S3 Lifecycle to archive old logsDepends on volume
Use NAT Instance instead of NAT Gateway~$32/mo per gateway
Rightsize EC2 (Compute Optimizer)10–50%
Schedule dev EC2/RDS off hours (nights/weekends)~60% for non-prod
Move to Graviton (m7g vs m7i)~20% price + ~10–40% perf
Use FARGATE_SPOT for batch workloads~70%

Compute Optimizer

# Enable Compute Optimizer for the account
aws compute-optimizer update-enrollment-status \
  --status Active \
  --include-member-accounts

# Get EC2 rightsizing recommendations
aws compute-optimizer get-ec2-instance-recommendations \
  --query 'instanceRecommendations[*].[instanceArn,finding,recommendationOptions[0].instanceType]' \
  --output table

# Lambda rightsizing
aws compute-optimizer get-lambda-function-recommendations \
  --query 'lambdaFunctionRecommendations[*].[functionArn,finding,memorySizeRecommendationOptions[0].memorySize]' \
  --output table

AWS Pricing Calculator

  • calculator.aws — model costs before deploying
  • Export estimates as CSV or JSON for team review
  • Save and share estimates via URL

Trusted Advisor (cost checks)

# List cost-related checks (requires Business/Enterprise support)
aws support describe-trusted-advisor-checks --language en \
  --query 'checks[?category==`cost_optimizing`].[id,name]' \
  --output table

# Get results for a specific check
aws support describe-trusted-advisor-check-result \
  --check-id Qch7DwouX1   # Low Utilization Amazon EC2 Instances