CreateAlarmModel - AWS IoT Events

CreateAlarmModel

Creates an alarm model to monitor an AWS IoT Events input attribute. You can use the alarm to get notified when the value is outside a specified range. For more information, see Create an alarm model in the AWS IoT Events Developer Guide.

Request Syntax

POST /alarm-models HTTP/1.1 Content-type: application/json { "alarmCapabilities": { "acknowledgeFlow": { "enabled": boolean }, "initializationConfiguration": { "disabledOnInitialization": boolean } }, "alarmEventActions": { "alarmActions": [ { "dynamoDB": { "hashKeyField": "string", "hashKeyType": "string", "hashKeyValue": "string", "operation": "string", "payload": { "contentExpression": "string", "type": "string" }, "payloadField": "string", "rangeKeyField": "string", "rangeKeyType": "string", "rangeKeyValue": "string", "tableName": "string" }, "dynamoDBv2": { "payload": { "contentExpression": "string", "type": "string" }, "tableName": "string" }, "firehose": { "deliveryStreamName": "string", "payload": { "contentExpression": "string", "type": "string" }, "separator": "string" }, "iotEvents": { "inputName": "string", "payload": { "contentExpression": "string", "type": "string" } }, "iotSiteWise": { "assetId": "string", "entryId": "string", "propertyAlias": "string", "propertyId": "string", "propertyValue": { "quality": "string", "timestamp": { "offsetInNanos": "string", "timeInSeconds": "string" }, "value": { "booleanValue": "string", "doubleValue": "string", "integerValue": "string", "stringValue": "string" } } }, "iotTopicPublish": { "mqttTopic": "string", "payload": { "contentExpression": "string", "type": "string" } }, "lambda": { "functionArn": "string", "payload": { "contentExpression": "string", "type": "string" } }, "sns": { "payload": { "contentExpression": "string", "type": "string" }, "targetArn": "string" }, "sqs": { "payload": { "contentExpression": "string", "type": "string" }, "queueUrl": "string", "useBase64": boolean } } ] }, "alarmModelDescription": "string", "alarmModelName": "string", "alarmNotification": { "notificationActions": [ { "action": { "lambdaAction": { "functionArn": "string", "payload": { "contentExpression": "string", "type": "string" } } }, "emailConfigurations": [ { "content": { "additionalMessage": "string", "subject": "string" }, "from": "string", "recipients": { "to": [ { "ssoIdentity": { "identityStoreId": "string", "userId": "string" } } ] } } ], "smsConfigurations": [ { "additionalMessage": "string", "recipients": [ { "ssoIdentity": { "identityStoreId": "string", "userId": "string" } } ], "senderId": "string" } ] } ] }, "alarmRule": { "simpleRule": { "comparisonOperator": "string", "inputProperty": "string", "threshold": "string" } }, "key": "string", "roleArn": "string", "severity": number, "tags": [ { "key": "string", "value": "string" } ] }

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in JSON format.

alarmCapabilities

Contains the configuration information of alarm state changes.

Type: AlarmCapabilities object

Required: No

alarmEventActions

Contains information about one or more alarm actions.

Type: AlarmEventActions object

Required: No

alarmModelDescription

A description that tells you what the alarm model detects.

Type: String

Length Constraints: Maximum length of 1024.

Required: No

alarmModelName

A unique name that helps you identify the alarm model. You can't change this name after you create the alarm model.

Type: String

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

Pattern: ^[a-zA-Z0-9_-]+$

Required: Yes

alarmNotification

Contains information about one or more notification actions.

Type: AlarmNotification object

Required: No

alarmRule

Defines when your alarm is invoked.

Type: AlarmRule object

Required: Yes

key

An input attribute used as a key to create an alarm. AWS IoT Events routes inputs associated with this key to the alarm.

Type: String

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

Pattern: ^((`[\w\- ]+`)|([\w\-]+))(\.((`[\w- ]+`)|([\w\-]+)))*$

Required: No

roleArn

The ARN of the IAM role that allows the alarm to perform actions and access AWS resources. For more information, see Amazon Resource Names (ARNs) in the AWS General Reference.

Type: String

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

Required: Yes

severity

A non-negative integer that reflects the severity level of the alarm.

Type: Integer

Valid Range: Minimum value of 0. Maximum value of 2147483647.

Required: No

tags

A list of key-value pairs that contain metadata for the alarm model. The tags help you manage the alarm model. For more information, see Tagging your AWS IoT Events resources in the AWS IoT Events Developer Guide.

You can create up to 50 tags for one alarm model.

Type: Array of Tag objects

Required: No

Response Syntax

HTTP/1.1 200 Content-type: application/json { "alarmModelArn": "string", "alarmModelVersion": "string", "creationTime": number, "lastUpdateTime": number, "status": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

alarmModelArn

The ARN of the alarm model. For more information, see Amazon Resource Names (ARNs) in the AWS General Reference.

Type: String

alarmModelVersion

The version of the alarm model.

Type: String

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

creationTime

The time the alarm model was created, in the Unix epoch format.

Type: Timestamp

lastUpdateTime

The time the alarm model was last updated, in the Unix epoch format.

Type: Timestamp

status

The status of the alarm model. The status can be one of the following values:

  • ACTIVE - The alarm model is active and it's ready to evaluate data.

  • ACTIVATING - AWS IoT Events is activating your alarm model. Activating an alarm model can take up to a few minutes.

  • INACTIVE - The alarm model is inactive, so it isn't ready to evaluate data. Check your alarm model information and update the alarm model.

  • FAILED - You couldn't create or update the alarm model. Check your alarm model information and try again.

Type: String

Valid Values: ACTIVE | ACTIVATING | INACTIVE | FAILED

Errors

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

InternalFailureException

An internal failure occurred.

HTTP Status Code: 500

InvalidRequestException

The request was invalid.

HTTP Status Code: 400

LimitExceededException

A limit was exceeded.

HTTP Status Code: 410

ResourceAlreadyExistsException

The resource already exists.

HTTP Status Code: 409

ResourceInUseException

The resource is in use.

HTTP Status Code: 409

ServiceUnavailableException

The service is currently unavailable.

HTTP Status Code: 503

ThrottlingException

The request could not be completed due to throttling.

HTTP Status Code: 429

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: