amazon-web-servicesamazon-snsamazon-cloudwatch

Prettify SNS JSON from Email


I am trying to receive an email with CodeBuild results that is readable. I currently have this working with SNS through a CloudWatch Event. When I receive my email, the JSON is not pretty and is hard to read. I am currently sending back the entire event as seen from the Cloudwatch Target Event below: enter image description here

As a note, I am not working for or with the Whitehouse. Just a cheeky name.

The result returns this via an email: {"version":"0","id":"555NOTREAL-97-0226-7d76-909ed659f3b1","detail-type":"CodeBuild Build State Change","source":"aws.codebuild",....

Into something like:

{
  "version": "0",
  "id":"555NOTREAL-97-0226-7d76-909ed659f3b1",
  "detail-type":"CodeBuild Build State Change",
  ....
}

I would essentially like to prettify this. Is this possible?


Solution

  • AWS SNS now offers 2 protocols for email subscriptions:

    When you select EMAIL-JSON, SNS will pretty-print JSON in the email it sends to you.

    AWS console screenshot below:

    enter image description here