

# CreateAlarmModel
<a name="API_CreateAlarmModel"></a>

**Important**  
End of support notice: On May 20,2026, AWS will end support for AWS IoT Events. After May 20,2026, you will no longer be able to access the AWS IoT Events console or AWS IoT Events resources. For more information, see [AWS IoT Events end of support](https://docs.aws.amazon.com/iotevents/latest/developerguide/iotevents-end-of-support.html). 

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](https://docs.aws.amazon.com/iotevents/latest/developerguide/create-alarms.html) in the * AWS IoT Events Developer Guide*.

## Request Syntax
<a name="API_CreateAlarmModel_RequestSyntax"></a>

```
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
<a name="API_CreateAlarmModel_RequestParameters"></a>

The request does not use any URI parameters.

## Request Body
<a name="API_CreateAlarmModel_RequestBody"></a>

The request accepts the following data in JSON format.

 ** [alarmCapabilities](#API_CreateAlarmModel_RequestSyntax) **   <a name="iotevents-CreateAlarmModel-request-alarmCapabilities"></a>
Contains the configuration information of alarm state changes.  
Type: [AlarmCapabilities](API_AlarmCapabilities.md) object  
Required: No

 ** [alarmEventActions](#API_CreateAlarmModel_RequestSyntax) **   <a name="iotevents-CreateAlarmModel-request-alarmEventActions"></a>
Contains information about one or more alarm actions.  
Type: [AlarmEventActions](API_AlarmEventActions.md) object  
Required: No

 ** [alarmModelDescription](#API_CreateAlarmModel_RequestSyntax) **   <a name="iotevents-CreateAlarmModel-request-alarmModelDescription"></a>
A description that tells you what the alarm model detects.  
Type: String  
Length Constraints: Maximum length of 1024.  
Required: No

 ** [alarmModelName](#API_CreateAlarmModel_RequestSyntax) **   <a name="iotevents-CreateAlarmModel-request-alarmModelName"></a>
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](#API_CreateAlarmModel_RequestSyntax) **   <a name="iotevents-CreateAlarmModel-request-alarmNotification"></a>
Contains information about one or more notification actions.  
Type: [AlarmNotification](API_AlarmNotification.md) object  
Required: No

 ** [alarmRule](#API_CreateAlarmModel_RequestSyntax) **   <a name="iotevents-CreateAlarmModel-request-alarmRule"></a>
Defines when your alarm is invoked.  
Type: [AlarmRule](API_AlarmRule.md) object  
Required: Yes

 ** [key](#API_CreateAlarmModel_RequestSyntax) **   <a name="iotevents-CreateAlarmModel-request-key"></a>
An input attribute used as a key to create an alarm. AWS IoT Events routes [inputs](https://docs.aws.amazon.com/iotevents/latest/apireference/API_Input.html) 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](#API_CreateAlarmModel_RequestSyntax) **   <a name="iotevents-CreateAlarmModel-request-roleArn"></a>
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)](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) in the * AWS General Reference*.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Required: Yes

 ** [severity](#API_CreateAlarmModel_RequestSyntax) **   <a name="iotevents-CreateAlarmModel-request-severity"></a>
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](#API_CreateAlarmModel_RequestSyntax) **   <a name="iotevents-CreateAlarmModel-request-tags"></a>
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](https://docs.aws.amazon.com/iotevents/latest/developerguide/tagging-iotevents.html) in the * AWS IoT Events Developer Guide*.  
You can create up to 50 tags for one alarm model.  
Type: Array of [Tag](API_Tag.md) objects  
Required: No

## Response Syntax
<a name="API_CreateAlarmModel_ResponseSyntax"></a>

```
HTTP/1.1 200
Content-type: application/json

{
   "alarmModelArn": "string",
   "alarmModelVersion": "string",
   "creationTime": number,
   "lastUpdateTime": number,
   "status": "string"
}
```

## Response Elements
<a name="API_CreateAlarmModel_ResponseElements"></a>

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](#API_CreateAlarmModel_ResponseSyntax) **   <a name="iotevents-CreateAlarmModel-response-alarmModelArn"></a>
The ARN of the alarm model. For more information, see [Amazon Resource Names (ARNs)](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) in the * AWS General Reference*.  
Type: String

 ** [alarmModelVersion](#API_CreateAlarmModel_ResponseSyntax) **   <a name="iotevents-CreateAlarmModel-response-alarmModelVersion"></a>
The version of the alarm model.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 128.

 ** [creationTime](#API_CreateAlarmModel_ResponseSyntax) **   <a name="iotevents-CreateAlarmModel-response-creationTime"></a>
The time the alarm model was created, in the Unix epoch format.  
Type: Timestamp

 ** [lastUpdateTime](#API_CreateAlarmModel_ResponseSyntax) **   <a name="iotevents-CreateAlarmModel-response-lastUpdateTime"></a>
The time the alarm model was last updated, in the Unix epoch format.  
Type: Timestamp

 ** [status](#API_CreateAlarmModel_ResponseSyntax) **   <a name="iotevents-CreateAlarmModel-response-status"></a>
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
<a name="API_CreateAlarmModel_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InternalFailureException **   
An internal failure occurred.    
 ** message **   
The message for the exception.
HTTP Status Code: 500

 ** InvalidRequestException **   
The request was invalid.    
 ** message **   
The message for the exception.
HTTP Status Code: 400

 ** LimitExceededException **   
A limit was exceeded.    
 ** message **   
The message for the exception.
HTTP Status Code: 410

 ** ResourceAlreadyExistsException **   
The resource already exists.    
 ** message **   
The message for the exception.  
 ** resourceArn **   
The ARN of the resource.  
 ** resourceId **   
The ID of the resource.
HTTP Status Code: 409

 ** ResourceInUseException **   
The resource is in use.    
 ** message **   
The message for the exception.
HTTP Status Code: 409

 ** ServiceUnavailableException **   
The service is currently unavailable.    
 ** message **   
The message for the exception.
HTTP Status Code: 503

 ** ThrottlingException **   
The request could not be completed due to throttling.    
 ** message **   
The message for the exception.
HTTP Status Code: 429

## See Also
<a name="API_CreateAlarmModel_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/iotevents-2018-07-27/CreateAlarmModel) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/iotevents-2018-07-27/CreateAlarmModel) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/iotevents-2018-07-27/CreateAlarmModel) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/iotevents-2018-07-27/CreateAlarmModel) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/iotevents-2018-07-27/CreateAlarmModel) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/iotevents-2018-07-27/CreateAlarmModel) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/iotevents-2018-07-27/CreateAlarmModel) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/iotevents-2018-07-27/CreateAlarmModel) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/iotevents-2018-07-27/CreateAlarmModel) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/iotevents-2018-07-27/CreateAlarmModel) 