AWS Cloud Operations Blog
Setting up an Amazon CloudWatch Billing Alarm to Proactively Monitor Estimated Charges
I’m pleased to announce the start of a multi-part series for CloudWatch Billing in which I will explore the techniques for proactively managing your AWS costs.
This series kicks off with a walkthrough of setting up CloudWatch Billing Alarms from the AWS console.
This walkthrough demonstrates how to enable Billing Alerts, create an Amazon CloudWatch Billing alarm, and connect the Amazon CloudWatch Billing alarm to an Amazon SNS topic for notifications when the alarm exceeds the specified threshold.
Amazon CloudWatch is a monitoring and observability service that provides a unified view of your application’s performance, resource utilization, and performance changes. Amazon CloudWatch is ideal for improving operational performance and resource optimization, such as creating alarms to notify you when your billing charges are exceeding a predefined threshold.
By using Amazon CloudWatch, you can better monitor your estimated AWS charges. By monitoring the estimated AWS charges for your AWS account(s), you can be alerted and proactively notified when the calculated estimated charges exceed the defined threshold, both from the AWS CloudWatch console and via SNS Notification.
Overview of Solution
Figure 1: CloudWatch Alarm Solution Overview
Walkthrough
In this walkthrough, you will complete the following steps.
- Enable Billing Alerts Monitoring from the AWS Console.
- Create an Amazon CloudWatch Billing Alarm using the AWS console.
- Configure conditions and thresholds for when the Amazon CloudWatch Billing alarm triggers.
- Define the Amazon SNS topic for SNS notification.
You can use the AWS CloudFormation template provided in this post to:
- Create an Amazon CloudWatch Billing Alarm.
- Create an Amazon SNS Topic.
The code in this post is available at Amazon CloudWatch Billing Alarm.yaml
Prerequisites
You need an AWS account with the IAM permissions required to access Amazon CloudWatch, Billing & Cost Management Console, and Amazon SNS. You will also need IAM permissions to AWS CloudFormation if you plan to deploy the sample template.
Enable Billing Alerts Monitoring
Before creating a Billing Alarm, in Amazon CloudWatch, you must enable billing alerts from the Billing and Cost Management console to ensure that the billing metrics data is available to Amazon CloudWatch.
Note: If you are using AWS Organizations or Consolidated Billing, then the Billing Alerts must be enabled from the Management/Payer account.
From the Billing and Cost Management console, select Billing preferences.
Figure 2: Select Preferences from AWS Billing Console.
On the Preferences page, select the checkbox for Receive Billing Alerts, and then click Save preferences.
Figure 3: Enabled Receive Billing Alerts
After enabling Billing Alerts for the first time, it can take approximately 15-30 minutes before you can view the billing data and set/configure billing alarms.
Creating the CloudWatch Billing Alarm
To create the billing alarm, you must first navigate to the CloudWatch console.
From the CloudWatch console, select Alarms from the navigation on the left side, then select Create Alarm.
Figure 4: Create a CloudWatch Billing Alarm
From the Specify metric and conditions page, choose Select metric. Then, select the Billing metric and drill down to Total Estimated Charge.
Figure 5: Select Billing under AWS Namespaces
Total Estimated Charges are monitored in USD. Select the USD option and choose Select metric.
Figure 6: Check the box for USD under Currency
On the next page, under Conditions define the threshold, in USD, you want this alarm to monitor and alert if Estimated Charges exceed the threshold, then click Next.
For this walkthrough, we want to be alerted when our estimated charges are greater than 1,000 USD, so that is what we’ll set for our threshold.
Figure 7: Add threshold value in USD
On the Configure actions page, select an SNS topic that will receive the notification when the alarm has been triggered, and then provide an email address. If you do not have an existing SNS topic, you must create an SNS Topic and return to this step.
This email address should correspond to the classification level of the environment.
Figure 8: Choose an existing SNS topic or create a new SNS topic for notifications
Under Add name and description, provide a unique name for the alarm and a description (optional), then click Next.
Figure 9: Add CloudWatch Alarm name and description
Under Preview and create, review the configurations and selections. You can edit any of the sections by clicking the Edit button for that corresponding section. Once you have confirmed the sections, click Create alarm.
Figure 10: Preview and create CloudWatch Alarm
Figure 11: Preview and create CloudWatch Alarm
Figure 12: Preview and create CloudWatch Alarm
Return to the CloudWatch console and select Alarms. You may see that the Alarm is in the Insufficient state. This is because we have the CloudWatch Billing Alarm checking the account every six hours, depending on your account it may take a few hours for this Alarm to display as Ok.
And that’s it! You’ve setup a CloudWatch Billing Alarm in the AWS console, and you will be notified every time your Estimated Charges goes over your predefined threshold.
Cleaning up
To avoid incurring future charges, delete the resources you created in this walkthrough.
- Delete the Amazon CloudWatch Billing Alarm
- Delete the SNS topic
- Delete the CloudFormation stack (if deploying the solution from the CloudFormation template)
Conclusion
This blog demonstrated how to enable Billing Alerts from the AWS Billing & Cost Management console. I also showed how to create and configure an Amazon CloudWatch Billing Alarm, and then associate that with an SNS topic for notifications. For more information, see Using Amazon CloudWatch alarms in the Amazon CloudWatch User Guide.
Now that you know how to create CloudWatch Billing Alarms from the AWS console, try taking this a step further by creating a multi-layer alarm that will notify you (or an email distro) when the Estimated Charges reach different predefined thresholds. You could also explore adding automation for creating Billing Alarms for newly created linked accounts with an AWS Organization.
Look out for subsequent posts where I will walk through how to take automate the creation of CloudWatch Billing Alarms using CloudFormation and Lambda.