Which solution will meet these requirements?
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.
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.
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.
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.
Explanations:
SCPs can only control actions at the organization or account level. Theiam:CreateAccessKeyaction doesn’t directly control the creation of IAM users and an explicit deny foriam:CreateAccessKeywould not address the requirement to limit user creation.
An SCP with a deny foriam:CreateUsercombined with a condition usingStringNotLikefor theaws:usernamewill effectively allow the creation of users only for those in the exception list, meeting the requirement.
Using EventBridge foriam:CreateAccessKeyis not relevant to restricting user creation, as this action is related to managing access keys, not creating IAM users.
While this option uses EventBridge to trigger an action based oniam:CreateUser, it is more complex and less efficient than using an SCP for this scenario. It would also require an additional Lambda function to delete the user, which is unnecessary for preventing creation in the first place.