Menu
Amazon CloudWatch
API Reference (API Version 2010-08-01)

SetAlarmState

Temporarily sets the state of an alarm for testing purposes. When the updated StateValue differs from the previous value, the action configured for the appropriate state is invoked. For example, if your alarm is configured to send an Amazon SNS message when an alarm is triggered, temporarily changing the alarm's state to ALARM sends an Amazon SNS message. The alarm returns to its actual state (often within seconds). Because the alarm state change happens very quickly, it is typically only visible in the alarm's History tab in the Amazon CloudWatch console or through DescribeAlarmHistory.

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

AlarmName

The descriptive name for the alarm. This name must be unique within the user's AWS account. The maximum length is 255 characters.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 255.

Required: Yes

StateReason

The reason that this alarm is set to this specific state (in human-readable text format)

Type: String

Length Constraints: Minimum length of 0. Maximum length of 1023.

Required: Yes

StateReasonData

The reason that this alarm is set to this specific state (in machine-readable JSON format)

Type: String

Length Constraints: Minimum length of 0. Maximum length of 4000.

Required: No

StateValue

The value of the state.

Type: String

Valid Values: OK | ALARM | INSUFFICIENT_DATA

Required: Yes

Errors

For information about the errors that are common to all actions, see Common Errors.

InvalidFormat

Data was not syntactically valid JSON.

HTTP Status Code: 400

ResourceNotFound

The named resource does not exist.

HTTP Status Code: 404