Eventbridge Pattern - Tag Change on Resource

0

Hi! I'm trying to create at rule in Eventbridge that will target a Lambda function when an RDS snapshot tag is changed. I followed the Tag Change on Resource sample and came up with

{ "source": ["aws.tag"], "detail-type": ["Tag Change on Resource"], "resources": ["arn:aws:rds:::snapshot:*"], "detail": { "changed-tag-keys": ["ShareStatus"], "service": ["rds"], "resource-type": ["snapshot"], "tags": { "ShareStatus": ["ready"] } } }

Changing or adding the tag to the RDS snapshot failed to trigger this event. I then modified the pattern to read:

{ "source": ["aws.tag"], "detail-type": ["Tag Change on Resource"], "resources": ["*"] }

This too failed to trigger the event. I stripped it down further to simply read:

{ "source": ["aws.tag"] }

This finally yielded the expected result. With that said, this event would now pick up on any tag change on any resource as opposed to my desired limit to RDS snapshots. So how can I adjust my event pattern to satisfy these needs? Thanks!

1개 답변
0

When editing the tags of an RDS snapshot, the events "AddTagsToResource" and "RemoveTagsFromResource" are logged in CloudTrail.
I created an event pattern so that Lambda can be executed using this event.

However, this event pattern also catches events about editing RDS instance tags, etc., in addition to RDS snapshots.
Therefore, please include a process on the Lambda side to determine whether the event is a snapshot tag edit event or an instance tag edit event.

{
  "source": ["aws.rds"],
  "detail-type": ["AWS API Call via CloudTrail"],
  "detail": {
    "eventSource": ["rds.amazonaws.com"],
    "eventName": ["AddTagsToResource", "RemoveTagsFromResource"]
  }
}
profile picture
전문가
답변함 일 년 전

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

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

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