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
エキスパート
回答済み 1年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ