1개 답변
- 최신
- 최다 투표
- 가장 많은 댓글
-1
The issue with your pattern is that you omitted the "Key" from there. It should be something like this (I based it on your example, did not check what the actual event looks like):
{
"source": ["aws.ec2"],
"detail-type": ["EC2 Instance State-change Notification"],
"detail": {
"state": ["running"],
"tagSpecificationSet": {
"items": {
"tags": {
"key": ["Name"]
}
}
}
}
}
Note, the above pattern will match any tag that has a Key = Name. I assume you want to have a rule that matches Name = Instance3. This, i.e., correlating two attributes, is not supported by EventBridge Rules. If all you do is catch events regarding instances that have a tag names Name, this will work.
관련 콘텐츠
- AWS 공식업데이트됨 9달 전
That's a nice catch ! Unfortunately it didn't work . Probably do to with the actual event itself. How can log the events? (I tired DQL , But didn't work) Bcoz I'm now suspecting the Amazon EC2 State Change Event doesn't have "TAG" link https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/EventTypes.html#ec2_event_type . I'm looking for the event when EC2 is successfully created . Based on the event/json, so I can trigger the Run command (Target) by getting the Instance ID .
The issue was due to the event not having the TAG
{ "version": "0", "id": "XX", "detail-type": "EC2 Instance State-change Notification", "source": "aws.ec2", "account": "123", "time": "2022-09-05T10:42:39Z", "region": "us-east-1", "resources": [ "XX" ], "detail": { "instance-id": "XX", "state": "running" } }
EC2 Instance State-change Notification do not specify tags within the Event JSON, for available JSON properties please see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-instance-state-changes.html