> ## Documentation Index
> Fetch the complete documentation index at: https://docs.inferless.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Model Alerts using AWS SNS

> You can integrate with Inferless for alerts by using SNS to send notifications about critical events related to model health.

### Types of alerts supported by Inferless

* You will be notified for the following events:
  1. Your model inference is getting a non 200 http response code
     * Sample SNS subject and message format
       * subject: "4xx errors increased for 4f1b4709-394b-4424-90f2-729881cee8cf by 1"
       * message:
         ```json theme={null}
         {
            "model_id": "4f1b4709-394b-4424-90f2-729881cee8cf",
            "model_url": "https://test-inferless.com/model-details?model_id=4f1b4709-394b-4424-90f2-729881cee8cf",
            "message": "The service https://test-inferless.com/model-details?model_id=4f1b4709-394b-4424-90f2-729881cee8cf had 1 4xx errors over the last 30 seconds.",
            "error_type": "4xx_error_increased",
            "value": 1
         }
         ```
  2. Your model inference latency is more than 20 seconds
     * Sample SNS subject and message format
       * subject: "High latency for 2c7f23d5-27b1-4e21-8dbf-f8c926e4385d above 20 seconds"
       * message:
         ```json theme={null}
         {
         "model_id": "2c7f23d5-27b1-4e21-8dbf-f8c926e4385d",
         "model_url": "https://test-inferless.com/model-details?model_id=2c7f23d5-27b1-4e21-8dbf-f8c926e4385d",
         "message": "The service https://test-inferless.com/model-details?model_id=2c7f23d5-27b1-4e21-8dbf-f8c926e4385d had latency above 20 seconds. Current latency in milliseconds: 59640 ms",
         "error_type": "latency_increased",
         "value": 59640
         }
         ```

### Steps to integrate with AWS SNS

* Create a new Standard SNS topic in your AWS account.
  <Frame caption="Create SNS topic.">
    <img src="https://mintcdn.com/inferless-68/gmxryf1AUBjwgBTM/images/sns-create-topic.png?fit=max&auto=format&n=gmxryf1AUBjwgBTM&q=85&s=b5d3cebe4d151e976ec533597a0955b4" alt="" width="2214" height="1236" data-path="images/sns-create-topic.png" />
  </Frame>

* Create and IAM user in your AWS account and add a SNS policy to write to topic
  <Frame caption="Create SNS user and write policy.">
    <img src="https://mintcdn.com/inferless-68/gmxryf1AUBjwgBTM/images/sns-create-policy.png?fit=max&auto=format&n=gmxryf1AUBjwgBTM&q=85&s=c3995bd0256387a01dbf3059869a970c" alt="" width="2150" height="944" data-path="images/sns-create-policy.png" />
  </Frame>

* Add the topic ARN, access and secret keys in the Manage Integrations --> Workspace Integrations --> AWS SNS section
  <Frame caption="Add SNS Integration">
    <img src="https://mintcdn.com/inferless-68/gmxryf1AUBjwgBTM/images/sns-add-integration.png?fit=max&auto=format&n=gmxryf1AUBjwgBTM&q=85&s=34a6dcc9b591eaaeee780198f878e1ab" alt="" width="2420" height="1252" data-path="images/sns-add-integration.png" />
  </Frame>

<Frame caption="Add SNS Integration">
  <img src="https://mintcdn.com/inferless-68/gmxryf1AUBjwgBTM/images/sns-manage-integration.png?fit=max&auto=format&n=gmxryf1AUBjwgBTM&q=85&s=aac6b3154735bb875b43311a4a88af86" alt="" width="2292" height="1494" data-path="images/sns-manage-integration.png" />
</Frame>

* You can also enable or disable alerts in Workspace Settings --> Integrations --> AWS SNS section
  <Frame caption="Enable Alerts">
    <img src="https://mintcdn.com/inferless-68/gmxryf1AUBjwgBTM/images/sns-enable-alerts.png?fit=max&auto=format&n=gmxryf1AUBjwgBTM&q=85&s=05420971fa8347d77aee93533e056aad" alt="" width="2164" height="1092" data-path="images/sns-enable-alerts.png" />
  </Frame>

* You can then create a subscription of choice to recieve notifications.
  <Frame caption="Create SNS subscription">
    <img src="https://mintcdn.com/inferless-68/gmxryf1AUBjwgBTM/images/sns-create-subscription.png?fit=max&auto=format&n=gmxryf1AUBjwgBTM&q=85&s=4a7ae7b7519b02abd7bdb21a4e937839" alt="" width="2066" height="1304" data-path="images/sns-create-subscription.png" />
  </Frame>
