CodeCommit - SNS Notification Beautify

0

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 Antworten
1

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

profile pictureAWS
MODERATOR
beantwortet vor 2 Jahren
0

An alternate solution is to use AWS Chatbot to forward pre-formatted CodeCommit notifications to your Slack channels. https://aws.amazon.com/blogs/devops/receive-aws-developer-tools-notifications-over-slack-using-aws-chatbot/

AWS
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen