bsmsapp/terraform/resources/lambda/lambdaError/lambda_handler.py

18 lines
479 B
Python

import json
import boto3
def main(event, context):
print(event)
record = event['Records'][0]
body = record["body"]
body = body.replace('\n', '')
body = json.loads(body)
query = body["body-json"]
message = "Error en la actualización de stock."
subject = "BSMSapp"
client = boto3.client("sns")
topic_arn = "arn:aws:sns:us-east-1:025685231147:" + query["username"]
client.publish(TopicArn=topic_arn, Message=message, Subject=subject)