CloudWatch alarms - Amazon IoT Core
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).

CloudWatch alarms

The CloudWatch alarm (cloudWatchAlarm) action changes the state of an Amazon CloudWatch alarm. You can specify the state change reason and value in this call.

Requirements

This rule action has the following requirements:

  • An IAM role that Amazon IoT can assume to perform the cloudwatch:SetAlarmState operation. For more information, see Granting an Amazon IoT rule the access it requires.

    In the Amazon IoT console, you can choose or create a role to allow Amazon IoT to perform this rule action.

Parameters

When you create an Amazon IoT rule with this action, you must specify the following information:

alarmName

The CloudWatch alarm name.

Supports substitution templates: API and Amazon CLI only

stateReason

Reason for the alarm change.

Supports substitution templates: Yes

stateValue

The value of the alarm state. Valid values: OK, ALARM, INSUFFICIENT_DATA.

Supports substitution templates: Yes

roleArn

The IAM role that allows access to the CloudWatch alarm. For more information, see Requirements.

Supports substitution templates: No

Examples

The following JSON example defines a CloudWatch alarm action in an Amazon IoT rule.

{ "topicRulePayload": { "sql": "SELECT * FROM 'some/topic'", "ruleDisabled": false, "awsIotSqlVersion": "2016-03-23", "actions": [ { "cloudwatchAlarm": { "alarmName": "IotAlarm", "stateReason": "Temperature stabilized.", "stateValue": "OK", "roleArn": "arn:aws:iam::123456789012:role/aws_iot_cw" } } ] } }

See also