A security engineer is replacing broad AWS managed IAM policies attached to an IAM role used by a script that runs with the AWS CLI. The current role has AmazonEC2FullAccess, AmazonDynamoDBFullAccess, and AmazonVPCFullAccess. The engineer must create a least privilege policy in the most operationally efficient way. What should the engineer do?
Choose an answer
Tap an option to check your answer.
Correct answer: Enable an AWS CloudTrail trail for management events. Run the script with the existing managed policies. Use IAM Access Analyzer to generate a policy based on the recorded access activity. Replace the managed policies on the role with the generated policy..
Why this is the answer
The most operationally efficient way to achieve least privilege is to leverage IAM Access Analyzer's policy generation feature. By enabling CloudTrail and running the script with the existing broad policies, CloudTrail records all API calls made by the script. IAM Access Analyzer can then analyze these CloudTrail logs to automatically generate a fine-grained, least-privilege policy based on the actual actions performed. This significantly reduces manual effort compared to iteratively adding permissions. Incorrect options: Removing policies and attaching the IAM Access Analyzer Role Policy Generator (which doesn't exist as a direct attachment) or attempting to generate a policy without prior activity will result in an empty or insufficient policy, causing the script to fail. Creating an account analyzer and archive rule in IAM Access Analyzer is for identifying external access to resources, not for generating least-privilege policies for internal IAM principals. Iteratively adding permissions based on CloudTrail authorization failures is a manual and time-consuming process, making it less operationally efficient than using Access Analyzer's automated generation.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed