AWS offers numerous services and resources. It has so many features available to make it a complete cloud platform. But with such diverse options, there are many chances to make a small mistake and generate unexpected bills. There is one way to protect ourselves from this, using cloudwatch and setting up billing alarm.
No matter if you are an expert developer, administrator or just starting with AWS, you should always keep eye on your AWS usage and its bills. That is why, one of your first steps, when you create a new AWS account, should be setting up billing alarm for your account. It takes a few minutes to create billing alert and will save you headaches while working with AWS. So let us see how to create a billing alarm for AWS.
Go to Cloudwatch and Check current AWS Region
For setting up billing alerts we first need to go to Cloudwatch. You can search Cloudwatch from your AWS console. Alternatively, you can click on the link to go to AWS Cloudwatch - https://console.aws.amazon.com/cloudwatch/
Now you need to check your current region. This is an important step. You can check your region in the top-right corner. You have to select the region as Northen Virginia or "us-east-1".
For all AWS accounts, Billing metric data is stored in N. Verginia region. So when you want to set up billing alarm you need to choose this region irrespective of region you use to set up AWS resources.AWS Facts
Creating AWS Billing Alarm
Once you finished with the above step, click on alarms under Alarms in the left pane on Cloudwatch dashboard. Next, click on "Create alarm" button which should be on the right side.
In the image below, you can see that we are using a new interface for AWS. This will help keep this article usable for a longer time. Even if you are using an old AWS interface, you can follow the same steps with few changes to placements of buttons.
Once you click on "Create alarm" button, on the next screen you have to select a metric for alarm. For that click on Select metric button. -> then find Billing in metrics list and click on it -> Then choose Total Estimated Charges -> finally choose the currency. In my case its USD. Then click on "Select matric" button.
Setting up Conditions
In the next step, you need to choose conditions that will trigger this alarm. Select the threshold type as Static. Then for an alarm condition, we will choose, "Greater/Equal". Finally, we want to enter the threshold value for our bill. This totally depends on your usage of AWS. In this case, I am keeping it at $10. This means once we have bills greater than or equal to $10, we will get alert from AWS.
After this click on the Next button.
Creating SNS Topic
In this step, we need to create SNS (Simple Notification Service) topic to notify when this alarm is triggered. And this SNS topic, in turn, will send us an email alert for this alarm.
For creating SNS topic select Create a new topic radio button. Then you have to give a name for this topic, and email id to notify when this alarm is triggered. You can enter multiple emails in this box.
After that, click on "Create topic" button. This should create a new SNS topic.
Then click on "Next" button at the bottom of the screen
Giving Name to Alarm
In this step, give the appropriate name and description for this alarm. Then click on "Next" button
Verify details And Create Alarm
On the final step, you need to verify all details and click on "Create alarm" button at the bottom of the screen. This should take you to the billing dashboard again.
Here you can see that we have pending confirmation in the action column. This is regarding confirming our email/s that we have entered while creating an SNS topic. We need to verify all the emails that we have entered. AWS will send a verification link to all of those emails. Unless you verify, you will not receive alerts on that email.
Check inbox for an email that you have entered in the previous step. You should see an email from AWS. Click on "Confirm subscription" link.
Once you click on this link, It should confirm your Email and you will receive alerts on this email whenever our billing alarm is triggered.
Varying Alarm status
After confirming the email, refresh Cloudwatch billing alarm dashboard. You should see that there is no more pending confirmation action remaining in front of our alarm. This should complete set up for creating a billing alarm.
That is it, You have configured your billing alarm and it should notify you if you cross your threshold amount for your bill in AWS. I hope you found this article useful. See you in next !!