5
votes

I am trying to send alarm emails when some errors are thrown in an AWS Lambda function. I could configure CloudWatch Alarms to send emails via SNS topics by creating an Alarm. If I have a python exception, the alarm is thrown an email is sent. I can see the exception data in the Cloudwatch Logs. However, the emails do not contain the exception data. They are only showing up in the Logs as as follows:

{
"errorMessage": "Example Test Failure",
"errorType": "Exception",
"stackTrace": [
    [
    "/var/task/lambda_function.py",
    7,
    "lambda_handler",
    "raise Exception('Example Test Failure')"
    ]
  ]
}

Is there a way to add this errorMessage to the text of the SNS email ?

1
Honestly, I've not really looked into this, but I think it should possible to format the content that the Cloudwatch alarm outputs. So essentially, you'd need to customize that template to include the errorMessage and post the data to SNS. Like i said, I've not looked into this, but I think it should be possibleoreoluwa

1 Answers