AWS CodeBuild
User Guide (API Version 2016-10-06)

The procedures in this guide support the new console design. If you choose to use the older version of the console, you will find many of the concepts and basic procedures in this guide still apply. To access help in the new console, choose the information icon.

Monitoring Builds with CloudWatch Alarms

You can create a CloudWatch alarm for your builds. An alarm watches a single metric over a period of time that you specify and performs one or more actions based on the value of the metric relative to a specified threshold over a number of time periods. Using native CloudWatch alarm functionality, you can specify any of the actions supported by CloudWatch when a threshold is exceeded. For example, you can specify that an Amazon SNS notification is sent when more than three builds in your account fail within fifteen minutes.

To create a CloudWatch alarm for a AWS CodeBuild metric

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

  2. In the navigation pane, choose Alarms.

  3. Choose Create Alarm.

  4. Under CloudWatch Metrics by Category, choose CodeBuild Metrics. If you know you want only project-level metrics, choose By Project. If you know you want only account-level metrics, choose Account Metrics.

  5. On Create Alarm, if it isn't already selected, choose Select Metric.

  6. Choose a metric for which you want to create an alarm. The options are By Project or Account Metrics.

  7. Choose Next or Define Alarm and then create your alarm. For more information, see Creating Amazon CloudWatch Alarms. For more information about setting up Amazon SNS notifications when an alarm is triggered, see Set Up Amazon SNS Notifications.

    The following shows an alarm that sends an Amazon SNS notification to a list named codebuild-sns-notifications when one or more failed builds are detected over 15 minutes. The 15 minutes is calculated by multiplying the five minute period by the three specified data points. The information displayed for a failed builds alarm at the project level or account level is identical.

  8. Choose Create Alarm.