AWS EventBridge Customise Output to include EC2 Tag Name

0

I've created an EventBridge Rule that notifies me using an SNS email when the Instance State of an EC2 changes, this works fine. I'm using the input transformer to customise the message and want to include the Name of the EC2 as well as the instance ID. Is this possible as the Name is a Tag ? The input so far is : {"account":"$.account","instance-id":"$.detail.instance-id","region":"$.region","state":"$.detail.state","time":"$.time"} Can this be tweaked to provide a tag or get the EC2 Name another way ?

질문됨 2년 전893회 조회
2개 답변
0

You can add more information to the original event (from producer) and create your own event to be handled by the consumer. Use SDK DescribeTags with the instanceID from the original event to Instance tags and add it to the custom event. See diagram:

                           ┌-----------------Custom event---------------- ┐
                           |                                              |  
| Producer | ---- >|Event bus|------ Event does not match tags ----> | Lambda Enrich |
                           |
                           └ --------match tags------>| Consumer| 
Igvir
답변함 2년 전
  • Hello @Igvir,

    I hope you doing well. Could you please elaborate on the diagram of how it works exactly? (I am pretty new to AWS) Did you mean need to create 3 rules? What does the mean Producer/Consumer/Lambda Enrich?

    Here are my input transformers: {"account":"$.account","instance":"$.detail.instance-id","region":"$.region","state":"$.detail.state","tags":"$.Key|Value","time":"$.time"}

    It would very helpful If you help me display the "instance name".

    Thanks in Advance!

0

Will give that a try thank you.

답변함 2년 전
  • Hey @RobWoodcock, Did you find the solution? we are in the same boat!

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠