AWS Certified DevOps Engineer – Professional — Question 88
A company's legacy application uses IAM user credentials to access resources in the company's AWS Organizations organization. A DevOps engineer must ensure that new IAM users cannot be created unless the employee who creates the IAM user is on an exception list.
Which solution will meet these requirements?
Answer options
- A. Attach an Organizations SCP with an explicit deny for all iam:CreateAccessKey actions with a condition that excludes StringEquals for aws:username with a value of the exception list.
- B. Attach an Organizations SCP with an explicit deny for all iam:CreateUser actions with a condition that includes StringNotLike for aws:username with a value of the exception list.
- C. Create an Amazon EventBridge (Amazon CloudWatch Events) rule with a pattern that matches the iam:CreateAccessKey action with an AWS Lambda function target. The function will check the user name and account against an exception list. If the user is not on the exception list, the function will delete the user.
- D. Create an Amazon EventBridge (Amazon CloudWatch Events) rule with a pattern that matches the iam:CreateUser action with an AWS Lambda function target. The function will check the user name and account against an exception list. If the user is not on the exception list, the function will delete the user.
Correct answer: B
Explanation
Option B is correct because it uses an SCP to explicitly deny the creation of IAM users for anyone not on the exception list, effectively enforcing the requirement. Option A incorrectly targets the iam:CreateAccessKey action instead of iam:CreateUser. Options C and D, while they might enforce a similar restriction, rely on event-driven functions which could introduce delays or issues in real-time enforcement compared to a direct SCP approach.