A lot of people when they sign up using AWS free tier, they amazed by the quantity of the services out there, which can be overwhelming, so set up a billing alarm is a must, so if you ended up leaving resources running accidentally, you don't get charged too much.
Create a billing Alarm
As we mentioned, we don't want ourselves to run out the bill accidentally, so we gonna create a billing alarm now, to make sure that doesn't happen.
We will be sticking to the free tier, even if you are not in the free tier, you should also set up a billing alarm.
Login to the aws console as root, then search for Billing
, click on it. In the left bottom, you will Billing preferences
click on it, then check the:
Receive Free Tier Usage Alerts
Receive Billing Alerts
Put your email
then click on Save preferences
Now if we reach the free tier limit we'll receive an email. But another thing we can do is specify a threshold to receive an alert.
Now go the the main console aws page, and search for a service called CloudWatch
.
A CloudWatch
is a performance monitoring tool, it's monitors your services using what's called metrics
, a metric is some information that sends to CloudWatch that tells it how much you're using, and that's why you can look up at the performance of your applications, and you can also use it to monitor how much you gonna spend on your resources.
What will do now is we want to create an alarm, so an alarm will be triggered when your metrics reach a certain threshold.
Now for anything related to billing we need to go up here and change the region, so for some services in AWS, for billing you have always to choose US East (N. Virginia)
.
Now we are in the right region, you can go across to the left and choose Alarms
.
Then Create alarm
:
Then Select metric
> Billing
> Total Estimated Charge
, choose USD
, then click on Select metric
, then choose this values:
Threshold type: static
Greater than: enter the max amount of money, for me I choose 5$, if my bill reaches 5 $ for example, I'm gonna get notifications to let me know what's happened,, choose a number that you are comfortable with, then hit Next
.
For Alarm state trigger
, we choose In alarm
.
We gonna use a service called SNS
, service notify you via different transport protocols, one of them being email.
Select Create new topic
, enter a Topic name
, for me I put : Billing_Notification
, type your email, then Create topic
.
You can view that in the SNS console
by clicking on it , we can see that we have billing notification configured, what you noticed is subscription is pending confirmation, go to the email client and we find the message there, confirm the subscription, after finishing with that, go back the alarm and hit Next
.
In Alarm name
, I will call it Billing_Alarm
, click Next
, then you will see the graph, go all to the down of the page then Create alarm
, and that's it we're done.