milo
milo

Reputation: 33

input transformer to get ec2 tags

How can I get cloudwatch to send me the project tag of the ec2?

I have a cloudwatch rule that notify me when an ec2 state changes (stop/start). Right now the alerts is emailing the ec2 current state and instanceId.

{"ec2state": "running"}
{"ec2id": "i-someEc2Id"}

How can I get cloudwatch to also send me the project tag of the ec2?

{"instance":"$.detail.instance-id","state":"$.detail.state"}

{"ec2state": "running"}
{"ec2id": "i-someEc2Id"}
{"ec2project": "projectname"}

Upvotes: 1

Views: 445

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269530

This is not possible.

Instead, you will need to write code that takes the Instance ID and then calls DescribeInstance() to obtain details about the instance, including tags.

Upvotes: 3

Related Questions