HOME

Usage Monitoring

Amazon documentation

Tracking your AWS Free Tier usage

Avoiding Unexpected Charges

Essentials

AWS sends you an email when you exceed 85% of any free tier limit, but if you do too much too fast, they might not have time to tell you. They'll hold your hand a little bit if you ask (i.e. read the documentation), but they won't always stop you from accidentally spending money. Keep an eye out for anything that seems like an extra -- when in doubt, look up "[feature/service name] pricing". Use the available tools to track usage:

Billing Alerts

In Billing Preferences, there's another option to Receive Billing Alerts. This takes you to CloudWatch, where you can configure alarms for service usage and billing thresholds. As always, there are features that cost, so double-check the pricing. The free tier gives you 10 free alarms and 1,000 free e-mail notifications per month.

You can create an alarm for the estimated charges by service or in total. Try creating one that emails you when your charges exceed $0.00:

  1. In the CloudWatch sidebar, go to Billing in the Alarms section.

    Note: The region in the upper right-hand corner should be N. Virginia as this is where billing metric data is stored.
  2. Click Create alarm.
  3. Click Select metric.
  4. Under Metrics, click Billing, then Total Estimated Charge.
  5. There should be only one row in the resulting table. Check the box in it, and click Select metric.
  6. Everything in the Metric section is fine at default.
  7. Period defines the time interval used to evaluate the metric. The tool recommends leaving the Period at the default of 6 hours. (TODO: why?)
  8. In the Conditions section, change the threshold type to Anomaly detection. Admire the graph and fantasize about how you might use this feature to avoid spending too much more money than you usually do, but without triggering the alarm on an arbitrary limit. Set it back to Static.
  9. Whenever EstimatedCharges is... Greater
  10. than... 0 USD (or more, if you just want to make sure you don't spend more than x dollars)
  11. Next
  12. Alarm state trigger: In alarm
  13. Select an SNS topic: Create new topic
  14. Rename the topic if you like, enter an email address, and click Create topic, then Next.
  15. Create an arbitrary name for the alarm and click Next.
  16. Review the configuration and click Create alarm.
  17. The new alarm will show "Pending confirmation" in the list. Check the email you entered for a subscription confirmation -- the alarm won't work until you confirm.

When I created this alarm, I already had a four-cent bill for the month, so it went into an alarm state immediately, and it didn't send an alert email after I confirmed the subscription. If you've already incurred charges this month, you may need to set the threshold above your current balance.

Test the alarm

  1. Open the CloudShell by clicking the "terminal" / "command prompt" icon in the upper right-hand corner, next to the bell and your account name.
  2. If you don't remember the alarm name, you can check using this command. Look for "AlarmName" near the top of the output. Mine is named "EstimatedCharges".
    aws cloudwatch describe-alarms
    Command reference: describe-alarms
  3. If the alarm already triggered but you didn't receive an email because you hadn't confirmed the subscription yet, first set the alarm to OK:
    aws cloudwatch set-alarm-state --alarm-name "EstimatedCharges" --state-value OK --state-reason "test"
    Command reference: set-alarm-state
  4. Now run the same command with --state-value ALARM.
  5. Check your email -- I received mine immediately.

Now, even though it's called "Estimated Charges," bear in mind that it works after the fact -- it isn't a usage forecast. Use the same procedure to create custom threshold alarms to alert you to specific things that might cause you to incur charges soon (50% seems like a good point to keep track of -- once that triggers, you should be able to do everything you already did this month again).