nerdexam
Amazon

SCS-C02 · Question #413

A security engineer is designing an IAM policy for a script that will use the AWS CLI. The script currently assumes an IAM role that is attached to three AWS managed IAM policies…

The correct answer is A. In AWS CloudTrail, create a trail for management events. Run the script with the existing AWS. Option A is correct because IAM Access Analyzer's policy generation feature uses CloudTrail management event logs to analyze the API calls a role actually makes, then automatically generates a least-privilege policy reflecting only those actions - this is far more efficient…

Submitted by neha2k· Mar 6, 2026Identity and Access Management

Question

A security engineer is designing an IAM policy for a script that will use the AWS CLI. The script currently assumes an IAM role that is attached to three AWS managed IAM policies:

AmazonEC2FullAccess, AmazonDynamoDBFullAccess, and AmazonVPCFullAccess. The security engineer needs to construct a least privilege IAM policy that will replace the AWS managed IAM policies that are attached to this role. Which solution will meet these requirements in the MOST operationally efficient way?

Options

  • AIn AWS CloudTrail, create a trail for management events. Run the script with the existing AWS
  • BRemove the existing AWS managed IAM policies from the role. Attach the IAM Access Analyzer
  • CCreate an account analyzer in IAM Access Analyzer. Create an archive rule that has a filter that
  • DIn AWS CloudTrail, create a trail for management events. Remove the existing AWS managed

How the community answered

(51 responses)
  • A
    49% (25)
  • B
    8% (4)
  • C
    29% (15)
  • D
    14% (7)

Explanation

Option A is correct because IAM Access Analyzer's policy generation feature uses CloudTrail management event logs to analyze the API calls a role actually makes, then automatically generates a least-privilege policy reflecting only those actions - this is far more efficient than manually auditing permissions. The workflow is: enable CloudTrail → run the script under existing broad permissions → let Access Analyzer generate a scoped-down policy from the observed activity.

Why the distractors fail:

  • B removes the broad policies before capturing usage, so the script can't run and no activity is logged - you have nothing to analyze.
  • C confuses two different Access Analyzer features; account analyzers with archive rules are for detecting external access to resources, not for generating least-privilege policies from usage logs.
  • D similarly removes the managed policies prematurely - without them, the script fails and CloudTrail captures nothing useful.

Memory tip: Think "capture, then cut" - you must observe actual usage first (CloudTrail + existing broad permissions), then use Access Analyzer to trim to what was actually called. Any option that removes permissions before observation is backwards and wrong.

Topics

#Least Privilege#IAM Policy#CloudTrail#Operational Efficiency

Community Discussion

No community discussion yet for this question.

Full SCS-C02 Practice