Data events must be explicitly enabled on the trail.
put-event-selectors REPLACES the trail’s entire selector set — it does not append. Sending
only the selector below to a trail that already has selectors silently drops the existing ones,
which can turn off data-event capture the customer relies on for audit or security. Read first,
merge, then write:
bash
aws cloudtrail get-event-selectors --trail-name my-trail# add your selector to the returned AdvancedEventSelectors[] list, keep the rest, then put the# COMPLETE merged list back
Check which selector style the trail uses first.get-event-selectors returns eitherAdvancedEventSelectorsor the basic EventSelectors, and put-event-selectors accepts only one
of the two. If the trail returned basic EventSelectors, writing --advanced-event-selectors
converts the trail and discards every basic selector — the same silent loss this callout is
about. In that case translate the existing basic selectors into advanced form as part of the merge,
and confirm the conversion with the customer before writing.
Confirm the merged set with the customer before writing. Note also that data events are billed
per event and are typically far higher volume than management events, so say what the selector
will match before enabling it.
bash
# The list below must be the COMPLETE set of selectors the trail should end up with,# i.e. existing selectors from get-event-selectors PLUS this new one.aws cloudtrail put-event-selectors --trail-name my-trail \ --advanced-event-selectors '[{ "Name": "S3DataEvents", "FieldSelectors": [ {"Field": "eventCategory", "Equals": ["Data"]}, {"Field": "resources.type", "Equals": ["AWS::S3::Object"]} ] }]'