By using AWS re:Post, you agree to the Terms of Use
/CodeCommit - SNS Notification Beautify/

CodeCommit - SNS Notification Beautify


Is there anyway to beautify the CodeCommit Notifications instead of getting a large JSON?

I was thinking of involving a Lambda function which receives that Large JSON and modify it, but i'm trying to find an easier way.

This is an example of the JSON sent through the SNS Topic configured in CodeCommit Notifications (Replaced acct. number with ?): {"account":"??","detailType":"CodeCommit Repository State Change","region":"us-east-1","source":"aws.codecommit","time":"2022-02-10T14:18:25Z","notificationRuleArn":"arn:aws:codestar-notifications:us-east-1:??:notificationrule/a6d8f86a6feb72ca5b3c342a1c0e463e5394f5e1","detail":{"referenceFullName":"refs/heads/dev","repositoryId":"3f8a3a4f-eac4-4077-b13c-fd1ac749171e","referenceType":"branch","commitId":"822aef94a812d7d73c2382f3a68ca187ea67aec9","callerUserArn":"arn:aws:iam::??:user/athmfiuser","event":"referenceUpdated","repositoryName":"athm-dev-athmfi-onpremiseapi-pipeline","oldCommitId":"29a8687b679861dc257dba49b9440db85b0ced0a","referenceName":"dev"},"resources":["arn:aws:codecommit:us-east-1:??:athm-dev-athmfi-onpremiseapi-pipeline"],"additionalAttributes":{}}

2 Answers

I can think of two options:

  1. Create a lambda that that subscribes to the SNS topic and use the JSON to sendEmail or sendTemplatedEmail using SES

  2. Use InputTransformer to customize the message going into SNS

answered 5 months ago

An alternate solution is to use AWS Chatbot to forward pre-formatted CodeCommit notifications to your Slack channels.

answered 5 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions