Using CloudFormation to set up an SMS AWS billing alarm

rav3n
2 min readMar 16, 2019

--

I’ve been trying to practice more Terraform and CloudFormation lately. Can you tell?

If you read my last post, I mentioned not having a billing alarm in place and racking up a $1,500 bill right during Thanksgiving. I really don’t recommend any follow in my footsteps on that one. I still remember logging into the console and discovering it…

When I set up the billing alarm the first time, I noticed I could only sign up for e-mail notifications. If I wanted SMS, I would have to switch over to SNS and subscribe to the same topic. Not hard but as practice, I threw this template together to streamline it.

Template here.

Don’t forget to triple check your SMS Phone Number or someone is going to get a strange text from an AWS number.

Once you’ve entered these parameters, Next => Next => Create Stack

A few requirements before this will work:

  • You will need to do this in your root account — below will display the difference between a non-root and root billing preferences

Exhibit A

Non-root Billing Preferences

Exhibit B

Root Account Billing Preferences
  • You will have to enable the setting (Receive Billing Alerts) shown below:
Note: Once you enable this, it cannot be disabled.

Once you are in the root account and the bill alert setting has been enabled (click the checkbox), jump over the console and switch to CloudFormation. From here, Create Stack and upload the YAML file from the repo.

For extra verification, if you switch over to SNS, you should see a new topic created with your SMS number as an endpoint.

I hope this has been somewhat helpful to someone. Thank you for reading!

--

--

No responses yet