EventBridge で CloudTrail の読み取り専用イベントが検知されない事象を回避するには
困っていた内容
EventBridge で CloudTrail の読み取り専用イベントを検知したいです。
設定したところ、書き込み専用イベントは検知されますが、読み取り専用イベントは検知されません。
なぜでしょうか。読み取り専用イベントも検知する方法を教えてください。
どう対応すればいいの?
ステータスを「有効 (CloudTrail の読み取り専用管理イベントを使用)」に設定してください。
EventBridge のステータスは次の 3 種類であり、「ENABLED
(有効)」に設定されている場合、CloudTrail を通じて配信される読み取り専用管理イベントは検知されません。
ENABLED
:有効ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS
:有効 (CloudTrail の読み取り専用管理イベントを使用)DISABLED
:無効
そのため、ステータスが「有効」に設定されている場合は、「有効 (CloudTrail の読み取り専用管理イベントを使用)」に更新してください。
2025年9月時点の仕様として、AWS マネジメントコンソールからは「有効 (CloudTrail の読み取り専用管理イベントを使用)」に更新できないため、AWS CLI や API 等から更新する必要があります。
AWS CLI の場合、put-ruleコマンドを実行します。
既存ルールを更新する場合、put-rule コマンドは省略した値を引き継がないため、更新する場合はご注意ください。
# コマンド例
$ aws events put-rule \
--name 【ルール名】 \
--event-pattern 【イベントパターン】 \
--state "ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS"
# 実行例
$ aws events put-rule \
--name "hato-Event-Rule" \
--event-pattern "{\"detail-type\":[\"AWS API Call via CloudTrail\"],\"source\":[\"aws.ssm\"],\"detail\":{\"eventName\":[\"GetParameter\"]}}" \
--state "ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS"
{
"RuleArn": "arn:aws:events:ap-northeast-1:123456789012:rule/hato-Event-Rule"
}
参考資料
- [アップデート] EventBridge イベントバスが CloudTrailからの read-only API アクションを監視できるようになりました | DevelopersIO
- Receiving read-only management events from AWS services - Amazon EventBridge
For each rule on the default or custom event buses, you can set the rule state to control the types of events to receive:
- Disable the rule so that EventBridge does not match events against the rule.
- Enable the rule so that EventBridge matches events against the rule, except for read-only AWS management events delivered through CloudTrail.
- Enable the rule so that EventBridge matches all events against the rule, including read-only management events delivered through CloudTrail.
…(中略)…
To create a rule that receives read-only management events using the AWS CLI
- Use the put-rule command to create or update the rule, using parameters to:
- Specify that the rule belongs on the default event bus, or a specific custom event bus
- Set rule state as ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS
aws events put-rule --name "ruleForManagementEvents" --event-bus-name "default" --state "ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS"Note
Enabling a rule for CloudWatch management events is supported through the AWS CLI and AWS CloudFormation templates only.