I was recently teaching a course on AWS services and an incident with a student group reminded me of the importance of Billing Alarms. This article is dedicated to all those who are getting started on Amazon Web Services (AWS) and don’t know how to protect themselves from incidents that can cause their bill to go up like a rocket.
If you are a beginner or someone interested in keeping a check on your usage, you will find it comforting to note that AWS has this awesome service called AWS CloudWatch, a service that is dedicated to monitoring of your AWS usage. It helps collect logs, metrics, outlier events (anomalies in usage etc) for your applications and using CloudWatch Alarms allows you to set up notifications to get alerted if your usage goes above a certain threshold. In general, like a friend of mine whom i discussed this article with said that anything which is postpaid, should have fences to limit the blast radius. When i heard this, i immediately thought about it and it in general applies to everything, your health, your relationships, money and work.
Steps for Setting a Billing Alarm
1. Login to your AWS Console at console.aws.amazon.com and go the CloudWatch Service.
2. Once within the CloudWatch service, click on Billing menu item.
3. Click on the Create Alarm button. On the screen, you will see two Create Alarm buttons, you need to click on the lower button. Its not that you cannot create a billing alarm using the button on the top, but it will require additional steps. For now, lets click on the second button on the page with the title “Create Alarm”.
4. You should see the screen as shown below, in case you don’t see the screen as shown that probably means you have clicked on the first “Create Alarm” button.
In the screen below, we can see
- Metric is EstimatedCharges
- Currency is USD
- Statistic is Maximum
- Period is 6 hours — this is the time period within which these checks will be made.
Above, we are going ahead with a simple static condition which will trigger an alarm whenever our EstimatedCharges metric crosses 100USD. This will be checked every 6 hours. Worst case scenario is when you hit the 100 USD mark at the 1st minute of the 6th hour window and that can lead to overflow.
5. Now that the Alarm condition is set, we need to configure actions. We will here, setup a notification to be sent to us when the Alarm state trigger is in “In Alarm”. AWS uses Simple Notification Service to deliver notifications and we will configure that to send us an email notification of this alarm.
6. Clicking on Create Topic will trigger an email to be sent to you. Click on the “Confirm subscription” link.
7. Scroll down and click on Next to create your Alarm.
8. Give a name and description to the Alarm that we are creating.
9. Once you click on Next, you will be able to see the following screen. If you haven’t confirmed your email from step 5, you will have to do that for the screen to appear as it is shown below.
Right now, given that we haven’t spent much time, State of the Alarm is in “Insufficient data” but it will change to “OK” once its been a while and enough data has been collected.
This is it, now you will get notified whenever your AWS usage goes above 100 USD.