Menu
Amazon CloudWatch
Developer Guide (API Version 2010-08-01)

Monitor Your Estimated Charges Using Amazon CloudWatch

You can monitor your estimated Amazon Web Services (AWS) charges using Amazon CloudWatch. When you enable the monitoring of estimated charges for your AWS account, the estimated charges are calculated and sent several times daily to Amazon CloudWatch as metric data that is stored for 14 days. Billing metric data is stored in the US East (N. Virginia) region and represent worldwide charges. This data includes the estimated charges for every service in AWS that you use, as well as the estimated overall total of your AWS charges. You can choose to receive alerts by email when charges have exceeded a certain threshold. These alerts are triggered by Amazon CloudWatch and are sent using Amazon Simple Notification Service (Amazon SNS) notification.

The metrics are provided free of charge, and you get 10 Amazon CloudWatch alarms and 1,000 Amazon SNS email notifications per customer per month for free. Any additional alarms or email notifications are priced at standard AWS rates. For more information, see Amazon CloudWatch Pricing, and Amazon SNS Pricing.

Enabling the Monitoring of Your Estimated Charges

Before you can create an alarm on your estimated charges, you must enable monitoring, which creates metric data that you can use to create a billing alarm. It takes about 15 minutes before you can view billing data and create alarms using the Amazon CloudWatch console or command line interface (CLI). You must be signed in as the account owner (the "root user") to enable billing alerts for your AWS account. After you enable billing metrics you cannot disable the collection of data, but you can delete any alarms you have created.

To enable the monitoring of estimated charges

  1. Open the Billing and Cost Management console at https://console.aws.amazon.com/billing/home?#.

  2. In the spaces provided, enter your user name and password, and then click Sign in using our secure server.

  3. In the navigation pane, click Preferences, and then select the Receive Billing Alerts check box.

Creating a Billing Alarm

You can use the Amazon CloudWatch console or the AWS command line interface (CLI) to create a billing alarm. You can apply more than one action to an alarm, or you can set the alarm to be triggered so that you receive an email when charges for a specified service exceed a certain amount.

To create a billing alarm using the Amazon CloudWatch console

In this example, you can graph your charges for Amazon EC2 over the last 14 days and then set an alarm that sends email as soon as your charges exceed $200.

  1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.

  2. In the navigation pane, click Alarms, and then in the Alarms pane, click Create Alarm.

  3. In the CloudWatch Metrics by Category pane, under Billing Metrics, click By Service.

  4. Under Billing > By Service, select a service (e.g., Amazon EC2) to view its billing data in a graph in the lower pane.

    Note

    There are several different ways you can view billing data for your account - Total Estimated Charges, By Service, or By Linked Account. For consolidated billing accounts, billing data for each linked account can be found by logging in as the paying account. You can view billing data for total estimated charges and estimated charges by service for each linked account as well as for the consolidated account.

  5. Click Next, and then under Alarm Threshold, in the Name box, enter a unique, friendly name for the alarm (for example, My Estimated Charges).

  6. In the Description box, enter a description for the alarm (for example, Estimated Monthly Charges).

  7. Under Whenever charges for, in the is drop-down list, select >= (greater than or equal to), and then in the USD box, set the monetary amount (for example, 200) that must be exceeded to trigger the alarm and send an email.

    Note

    Under Alarm Preview, in the Estimated Monthly Charges thumbnail graph, you can see an estimate of your charges that you can use to set an appropriate threshold for the alarm.

  8. Under Actions, click Notification, and then in the Whenever this alarm drop-down menu, click State is ALARM.

  9. In the Send notification to box, select an existing Amazon SNS topic.

    To create a new Amazon SNS topic, click New list, and then in the Send notification to box, enter a name for the new Amazon SNS topic (for example, CFO), and in the Email list box, enter the email address (for example, john.stiles@example.com) where email notifications should be sent.

    Note

    If you create a new Amazon SNS topic, the email account associated with the topic will receive a subscription confirmation email. You must confirm the subscription in order to receive future email notifications when the alarm is triggered.

  10. Click Create Alarm.

    Important

    If you added an email address to the list of recipients or created a new topic, Amazon SNS sends a subscription confirmation email to each new address shortly after you create an alarm. Remember to click the link contained in that message, which confirms your subscription. Alert notifications are only sent to confirmed addresses.

  11. To view your billing alarm in the CloudWatch console, in the navigation pane, under Alarms, click Billing.

To create a billing alarm using the CLI

In addition to using the Amazon CloudWatch console, you can also use the AWS command line interface (CLI) to create a billing alarm for any service in AWS that you're using. You can apply more than one action to an alarm, or you can set the alarm to be triggered so you receive an email when charges for a specified service fall below a certain amount.

The example in the following procedure creates an alarm that will send an email message when your estimated month-to-date charges for Amazon EC2 exceed $50.

  1. At a command prompt, type aws cloudwatch list-metrics to view the list of all available Amazon CloudWatch metrics for the services in AWS that you're using.

  2. In the list of metrics, review the billing metrics that have the AWS/Billing namespace. These are the billing metrics that you can use to create a billing alarm.

  3. At the command prompt, enter the following command:

    aws cloudwatch put-metric-alarm --alarm-name ec2billing --comparison-operator GreaterThanOrEqualToThreshold --evaluation-periods 1 --metric-name EstimatedCharges --namespace AWS/Billing --dimensions Name=Currency,Value=USD" --period 21600 --statistic Maximum --threshold 50 --actions-enabled --alarm-actions arn:aws:sns:us-east-1:111122223333:NotifyMe

    Where:

    The --alarm-name is the name that you want to give the alarm.

    The --comparison-operator is one of the following values: GreaterThanOrEqualToThreshold, GreaterThanThreshold, LessThanThreshold, or LessThanOrEqualToThreshold.

    The --evaluation-periods are the number of periods over which data is compared to the specified threshold (e.g., One period equals 6 hours).

    The --metric-name is one of the available billing metrics (e.g., EstimatedCharges).

    The --namespace is the metric’s namespace (e.g., AWS/Billing).

    The --dimensions are associated with the metric (e.g., Currency=USD).

    The --period is the time frame (in seconds) in which Amazon CloudWatch metrics are collected. In this example, you would enter 21600, which is 60 seconds multiplied by 60 minutes multiplied by 6 hours.

    The --statistic is one of the following values: SampleCount, Average, Sum, Minimum, or Maximum.

    The --threshold is the dollar amount you want to use e.g., 50.

    The --actions-enabled indicates that the alarm should perform an action. Use --no-actions-enabled to disregard the --alarm-actions.

    The --alarm-actions is the list of actions to perform when this alarm is triggered. Each action is specified as an Amazon Resource Name (ARN). In this example, we want the alarm to send us an email using Amazon SNS.

    Note

    You can find the ARN for the Amazon SNS topic that the alarm will use in the Amazon SNS console:

    1. Open the Amazon SNS console at https://console.aws.amazon.com/sns/.

    2. If necessary, change the region. From the navigation bar, select the region that meets your needs. For more information, see Regions and Endpoints.

    3. On the navigation pane, under My Topics, select the topic you want the alarm to send mail to.

    4. The ARN is located in the Topic ARN field on the Topic Details pane.

Editing a Billing Alarm

You can edit an existing billing alarm and make changes to it using the Amazon CloudWatch console or the AWS command line interface (CLI).

To edit a billing alarm using the Amazon CloudWatch console

  1. Sign in to the AWS Management Console and open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.

  2. If necessary, change the region to US East (N. Virginia). Billing metric data is stored in the US East (N. Virginia) region and represent worldwide charges. For more information, see Regions and Endpoints.

  3. In the navigation pane, under Alarms, click Billing.

  4. In the list of alarms, select the check box next to the alarm you want to change, and then click Modify.

  5. Under Alarm Threshold, in the USD box, set the monetary amount (for example, 400) that must be exceeded to trigger the alarm and send an email, and then in the navigation pane, click Save Changes.

To edit a billing alarm using the CLI

  1. At a command prompt, type aws cloudwatch describe-alarms, and then press Enter.

  2. In the list, locate the alarm you want to edit.

  3. At the command prompt, type aws cloudwatch put-metric-alarm --alarm-name <alarm name>, where <alarm_name> is the name of the alarm you want to edit. Specify all of the parameters in the alarm you want to edit, and change any of the values as appropriate.

Checking Alarm Status

You can check the status of your billing alarms using the Amazon CloudWatch console or the AWS command line interface (CLI).

To check alarm status using the Amazon CloudWatch console

  1. Sign in to the AWS Management Console and open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.

  2. If necessary, change the region to US East (N. Virginia). Billing metric data is stored in the US East (N. Virginia) region and represent worldwide charges.

    From the navigation bar, select the region that meets your needs. For more information, see Regions and Endpoints.

  3. In the navigation pane, under Alarms, click Billing.

To check alarm status using the CLI

  • At a command prompt, type aws cloudwatch describe-alarms, press Enter, and then in the list, locate the AWS/Billing alarm you want to check.

Deleting a Billing Alarm

You can delete a billing alarm when you no longer need it using the Amazon CloudWatch console or the AWS command line interface (CLI).

To delete a billing alarm using the Amazon CloudWatch console

  1. Sign in to the AWS Management Console and open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.

  2. If necessary, change the region to US East (N. Virginia). Billing metric data is stored in the US East (N. Virginia) region and represent worldwide charges.

    From the navigation bar, select the region that meets your needs. For more information, see Regions and Endpoints.

  3. In the navigation pane, under Alarms, click Billing.

  4. In the list of alarms, select the check box next to the alarm you want to delete, and then click Delete.

  5. In the Delete Alarms dialog box, click Yes, Delete.

To delete a billing alarm using the CLI

  1. At a command prompt, type aws cloudwatch describe-alarms, and then press Enter.

  2. In the list, locate the alarm you want to delete.

  3. At the command prompt, type aws cloudwatch delete-alarms -–alarm-names <alarm_name>, where <alarm_name> is the name of the alarm you want to delete.

  4. At the Are you sure you want to delete these Alarms? prompt, type Y.