AWS Certified DevOps Engineer – Professional
CloudTrail data events, event selectors and organization trails
By default a CloudTrail trail logs management events only. The CloudTrail User Guide says data events and network activity events must be added explicitly and cost extra. Advanced event selectors filter them by fields such as readOnly, eventName and resources.ARN. An organization trail logs events for the management account and all member accounts.
Which events does a trail record?
Management events cover management operations on resources and are logged by default. Data events cover operations performed on or in a resource, such as S3 object-level activity, Lambda function invocations and DynamoDB item-level activity. They are often high volume, are not logged by default, and have additional charges. You add each resource type you want.
Network activity events record AWS API calls made through a VPC endpoint, for the endpoint owner. They are also off by default and charged separately. Insights events capture unusual API call rates or error rates.
For S3 objects, both API callers and resource owners can receive events. If you own an object named in your trail, the trail also logs calls that other accounts make to it. If another account owns the object, your trail logs only the calls made in your account.
Basic vs advanced event selectors
Basic event selectors can log data events only for S3 buckets and objects, Lambda functions and DynamoDB tables. Advanced event selectors can log data events for all resource types.
A trail uses either basic or advanced event selectors, not both. Applying advanced event selectors overwrites any existing basic selectors. To convert a trail, run get-event-selectors to record the current selection, configure advanced selectors that match that coverage, then add the new resource types.
Advanced selector fields include readOnly, eventName, resources.ARN, resources.type and userIdentity.arn. readOnly equal to false keeps write events, which add, change or delete resources. Leaving readOnly out logs both reads and writes. With equals on resources.ARN, the value must exactly match a resource ARN. StartsWith, EndsWith, NotStartsWith and NotEndsWith match the beginning or end of a field, which is how a prefix is selected or a caller excluded.
Organization trails and the delegated administrator
An organization trail delivers events from the management account and all member accounts to the same S3 bucket. A copy of the trail with the same name is created in each member account. Trails created in the console are multi-Region. The AWS CLI can create a single-Region or multi-Region organization trail.
Only the management account or a delegated administrator account can create an organization trail. The management account adds or removes delegated administrators, and an organization can have at most three. A delegated administrator can create, update and delete organization trails.
The management account remains the owner of every organization trail, including those a delegated administrator creates. Removing the delegated administrator does not delete them.
Where the exam catches people
- Believing a new trail records S3 object-level calls: data events are not logged by default and must be added.
- Believing advanced selectors can be added beside basic ones: a trail uses one kind, and applying advanced selectors overwrites the basic ones.
- Believing basic event selectors can log any resource type: they cover only S3, Lambda and DynamoDB data events.
- Believing equals on
resources.ARNmatches a prefix: equals needs an exact ARN. UseStartsWithfor a bucket prefix. - Believing a trail created by a delegated administrator belongs to that account: the management account remains the owner.