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 個答案
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
管理員
已回答 2 年前
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
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南