Certopolis

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.ARN matches a prefix: equals needs an exact ARN. Use StartsWith for a bucket prefix.
  • Believing a trail created by a delegated administrator belongs to that account: the management account remains the owner.

Written from these sources

Try 3 questions on this

Pick an answer to see why each option is right or wrong.

  1. A company's release pipeline writes build artifacts under the prod/ prefix of an Amazon S3 bucket named release-artifacts in account 111122223333. The pipeline runs as an IAM role named release-pipeline-role. The account's AWS CloudTrail trail logs management events and has one advanced event selector for S3 object data events, which a DevOps engineer is now filling in. The security team must record every change that any other identity makes to objects under prod/, including uploads, overwrites and deletions. Reads, activity elsewhere in the bucket and the pipeline's own writes must not be logged, to keep data event charges low. Which combination of steps should the DevOps engineer take to meet these requirements? (Select THREE.)

    Right. In the game that’s Renown for your Security and Compliance building.

    Not that one: A,B,D is right. In the game your Security and Compliance building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    Writes of every kind, including deletions, are captured by readOnly false rather than by naming one API. The pipeline's own changes drop out by matching the identity CloudTrail actually records for a role session, an sts assumed-role ARN that ends with the session name, so the exclusion has to match its start, not the IAM role ARN.

    Written from docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html

  2. A company's AWS CloudTrail trail in its production account logs all management events. The trail also logs Amazon S3 data events for the bucket hr-archive and AWS Lambda Invoke events for one function, set up years ago with basic event selectors. Workloads in private subnets call AWS Key Management Service (AWS KMS) through an interface VPC endpoint. The security team must now record every KMS API call that passes through that endpoint, with the caller's identity, so that it can spot credentials from outside the organization. The S3 and Lambda data event logging must continue without a gap. Which solution will meet these requirements?

    Right. In the game that’s Renown for your Security and Compliance building.

    Not that one: D is right. In the game your Security and Compliance building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    Those selectors exist only in the advanced form, and a trail runs either basic or advanced selectors, never both: the moment advanced selectors are applied, the old basic ones are replaced. So the change has to carry the management event, hr-archive and Lambda selections across as advanced selectors in the same update. Leaving errorCode unset keeps successful calls too, which is what shows an outside credential that the endpoint let through.

    Written from docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-concepts.html

  3. A company has 70 accounts in an organization in AWS Organizations. The management account has a multi-Region AWS CloudTrail trail named mgmt-trail that records only that account's events. The DevOps team runs an AWS CodePipeline pipeline in the security tooling account, and the security team wants that pipeline to own the company's audit trail from now on. The trail must record management events from every account, and the pipeline will change the trail's event selectors as audit needs change. Apart from one setup step, nobody may sign in to the management account for this work. Which combination of steps should the DevOps engineer take to meet these requirements? (Select THREE.)

    Right. In the game that’s Renown for your Security and Compliance building.

    Not that one: B,E,F is right. In the game your Security and Compliance building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    From then on the tooling account can create, update and delete organization trails, so the pipeline creates a fresh organization trail there rather than converting mgmt-trail, and later edits that trail's event selectors in place. Every member account, including accounts added later, receives the trail automatically.

    Written from docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-delegated-administrator.html

Ask for something