Restricts who can create IAM access keys, allowing them only for automation roles to reduce credential sprawl.
What this SCP does
This Service Control Policy (SCP) restricts who can create IAM access keys, allowing them only for automation roles to reduce credential sprawl. This improves security by limiting long-term credentials.
The policy denies the creation of IAM access keys for any principal that doesn't have an ARN matching the pattern "arn:aws:iam::*:role/Automation*". This ensures that only roles specifically designed for automation can create access keys, reducing the risk of unnecessary long-term credentials.
How to test this SCP works
To validate this SCP, try to create access keys for different IAM roles and users:
We expect access key creation to be denied with an AccessDenied error when attempted by any principal that doesn't match the "arn:aws:iam::*:role/Automation*" pattern. Note that testing this effectively requires assuming different roles, which can be complex in a test environment.