*Version: 1.0 | Last Updated: 2025-03-13* ## Overview - **Integration Name:** AWS SNS - **Purpose:** To integrate AWS with MoovingON AI, enabling users to receive AWS alerts through MoovingON AI. - **Purpose:** Support team, TAM - **Prerequisites:** - A valid AWS account - MoovingON AI account access with integration permissions --- ## Table of Contents - [[#Setup Instructions]] - [[#Configuration]] - [[#Testing the Integration]] - [[#Related Links]] --- ## Setup Instructions 1. Step 1: In MoovingON AI, navigate to Settings -> Integrations. ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXcRlVOIXdQo-3K1ZK6_yb3RassT5Hwm4HV4HbrMYQXOEGy84c_b-GkCM8dniycVDIIFCnO2aZjV4JlFtbdfGglmJyazL4q0aVk0BgHiuV4HBeSf9DGLdSRe2LJ4YQR5PKlMwKNbag?key=KBEKAuRqwRONFDBsNTxVIo1q) 2. Step 2: On the right side of the page, select "Add Webhook." ![add-webhook.png](https://lh7-rt.googleusercontent.com/docsz/AD_4nXcIK0v0mFX3JZay_sfhiCIID1caSrVTm13IU9eFcBS6OLZaubWz9b7ryjIiTF-vLXoK_ZUbj9u3M4vAMxIdBRAdbzOGo8fY7TpAJaxdCAAnFp41yA6Ohp-37MjWjSnxNXxkl0-wSA?key=pWeWSRwPH8MCV1bVqRvIPmbR) 3. Step 3: Enter an integration name for the webhook and click "Submit." ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXegXOiH_ed_yvnovas7N8A_4Gy0f7cdbR1R0eILGQ8iL5ZiuSCpGff9k1YuDRo5Xe2fdgQ4IWSCY-lIimkAyG44-YodYT8QzU6KZRk8mXP3_JEfaH3dKNLP-ThTE2Lmbhxcyis-DA?key=KBEKAuRqwRONFDBsNTxVIo1q) 4. Step 4: A webhook basic authentication (Username and Token) will be created after submission. **![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdftB0KFsctdudQ70rgU0rCtuwFirMXIieZRJF5g8CSVfPwbokdBuDG0BcAOYWS3NApNu0xYPGRtP4SASRVuT9jjNn92sFW9iNDMRJsww8pEpzgWOaUoPJAv9uSGEGDCh_p0JV_?key=KBEKAuRqwRONFDBsNTxVIo1q)** - Save the generated Username and Token for use in AWS SNS --- ## Configuration #### 1. Setting the Lambda function push  Need to create a new AWS Lambda python3 function that will translate the SNS message to MoovingON AI, let's name it “PushEvents2MoovingON” The function code: import json import urllib3 import logging import ast http = urllib3.PoolManager() logger = logging.getLogger() logger.setLevel(logging.INFO) def lambda_handler(event, context): # URL for MoonActive Demo test url = "{ENDPOINT}" #eventmessage = ast.literal_eval(event['Records'][0]['Sns']['Message']) #eventmessage = event['Records'][0]['Sns']['Message'] #print(eventmessage) messagesns = json.loads(event['Records'][0]['Sns']['Message']) message = { "service": messagesns['Service'], "host": messagesns['Host'], "value": messagesns['Value'], "severity": "CRITICAL" } headers = { 'Content-Type': 'application/json', 'Authorization': 'Basic {AUTHKEY} } encoded_msg = json.dumps(message).encode('utf-8') response = http.request('POST', url, body=encoded_msg, headers=headers) logger.info('Start New Push!!!') logger.info('Status Code: {}'.format(response.status)) logger.info('Response: {}'.format(response.data)) **NOTE**: The **{AUTHKEY}** should be extracted as in the [[#Setup Instructions]] **![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXfSKPpQfmn4tH5mM7i0E1ZWwVLUklyR13be_WEcBaYfLVt4dRFEop4wMOue3rnRDsJQUpLYhyQS-sH-nGIFgPBtwy3nZitnmmF-WKLjpmF0y9S-qkk3tI92jT9jfdFlgPxbixgnlQ?key=KBEKAuRqwRONFDBsNTxVIo1q)** #### 2. **SNS Topic** - **Open the SNS Topic and press the Create subscription button** **![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdbw0hxogjFMo6aHt53ND_KDbOKRXu5CGLpg4gM5TXyyXkBTfiD4XQUDOX-AB4qdez_MJBWydZEIicuWl9wdWeVrIeHHbH9GyzehFNHNUdM0kVpJmmgRR1R4jwZFxj8L10X_26I?key=KBEKAuRqwRONFDBsNTxVIo1q)** - **Create Subscription** Choose the Protocol “AWS Lambda”, copy the ARN ID from the Lambda function “PushEvents2MoovingON” into the Endpoint and press the Create subscription button **![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXcMbHXxPsftplpssPTUV4jobM3MjoB1HZkR9crOlFaQUtJ9evmFKo6cyy2eIBhCYruql8F3on9U6mtf9XTI9i25S8QgispL9xS0HmTG7mo8L8Uhw2BXieaJIf_knc_D3qe5vflkpQ?key=KBEKAuRqwRONFDBsNTxVIo1q)** Creating a subscription: **![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXf-10ivEu_6ebgTo0GEaG3FW4GGcMjUa1U-rR_w4Snk8OOp-ROJuoze3KiQAQYck19qhGdBbpOGasySCHm9s0Vzntd2DWiOotHA4xF7efjbsUIoJb50LT7e9Nr3tkb6wK4zNLFdhw?key=KBEKAuRqwRONFDBsNTxVIo1q)** You should see a new subscription LAMBDA in the Topic **![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXePrrKw1Ul5X-_qQXDYRteZSCcnu2p6JYbGWxMRD3YSLZ8jHrRkAPe9emzDHJADew5QRqnbaCisSW4Q_-wizpTRMVAnn6H2jgpke8NDdc_hJi0VLsPWCThp7fI03aLVm24ZnBF4?key=KBEKAuRqwRONFDBsNTxVIo1q)** --- ## Testing the Integration To test it, press the button Publish message inside the subscription: **![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXf7wg4AUnCxpa9NIARFIGywVirBe6JOURGV3tZf3qt7kZa1BawVxFDs3DSrMQ88_91EuNzC-zy0oI-VLH8_F9eKdO0EnsQrORgULlgSFZUygrvkXlNMWWnbCmupywIoo95MURIeiQ?key=KBEKAuRqwRONFDBsNTxVIo1q)** For example, we used this message: { "default": "Sample fallback message", "lambda": "{\"Host\":\"TestHost\",\"Service\": \"TestService\",\"Value\":\"TestValue\"}" } **![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXcqxf5njxmqSzxMdysrZT42cJyxGS056pVpy9u8sUKKCSE7Nqcq8Z-VhHptkBFya0P5UsG5dXRjTkYMhfU2jk9_CaUFs0awcO-Qg-Pp5j96JcHIe3N0gKrmL-mPt_DNVnRtztN40A?key=KBEKAuRqwRONFDBsNTxVIo1q)** Alert in MoovingON AI: **![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXfie_j4Q1r2nH3WLt6pK53GYXoX70eXZspW6t2_4b_QinR8McjGyc32QTdFuGXLJPgxJ6PBpB2hL53D3gouX9-ms8bDg_Cf02i6QdgWhryNpXaLblYnw50Gp_doD1RnM5lDXeoIiw?key=KBEKAuRqwRONFDBsNTxVIo1q)** --- ## Related Links - **External Resources:** [AWS Lambda](https://docs.aws.amazon.com/lambda/) , [AWS SNS](https://docs.aws.amazon.com/sns/)