CloudWatchAlarm - Amazon CodePipeline
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

CloudWatchAlarm

When you create a condition, you can add the CloudWatchAlarm rule. This section provides a reference for the rule parameters. For more information about rules and conditions, see How do stage conditions work?.

You must have already created an alarm in Amazon CloudWatch as a separate resource.

Important

In cases where the DeploymentWindow rule and the CloudWatchAlarm rule are contained together in an entry condition, it is possible that the CloudWatchAlarm alarm might succeed before the deployment window for the DeploymentWindow rule opens. After the deployment window opens, CodePipeline does not check the CloudWatchAlarm alarm again. This can result in an alarm state when the pipeline execution enters the stage.

Rule type

  • Category: Rule

  • Owner: AWS

  • Provider: CloudWatchAlarm

  • Version: 1

Configuration parameters

AlarmStates

Required: Yes

The desired CloudWatch alarm states for the rule to monitor. Valid values are ALARM, OK, and INSUFFICIENT_DATA.

AlarmName

Required: Yes

The name of the CloudWatch alarm. This is a separate resource created in CloudWatch.

WaitTime

Required: No

The wait time in minutes to allow for a state change before running the rule result. For example, configure 20 minutes to wait for an ALARM state to change to OK before applying the rule result. For the Entry condition, this is the amount of time CodePipeline will wait if the alarm is in ALARM state when it is first evaluated. If the alarm is in OK state when the rule is first checked, the rule will immediately succeed.

Example rule configuration

YAML
rules: - name: MyMonitorRule ruleTypeId: category: Rule owner: AWS provider: CloudWatchAlarm version: '1' configuration: AlarmName: CWAlarm WaitTime: '1' inputArtifacts: [] region: us-east-1
JSON
"rules": [ { "name": "MyMonitorRule", "ruleTypeId": { "category": "Rule", "owner": "AWS", "provider": "CloudWatchAlarm", "version": "1" }, "configuration": { "AlarmName": "CWAlarm", "WaitTime": "1" }, "inputArtifacts": [], "region": "us-east-1" } ] }

The following related resources can help you as you work with this rule.