How do you test whether a policy will allow an action before deploying it?
BeginnerConceptIAM Advanced, STS and Multi-Account
Answer
Use the IAM Policy Simulator (console) or the CLI, which evaluates identity policies, boundaries and optionally SCPs against a list of actions and resources.
aws iam simulate-principal-policy \
--policy-source-arn arn:aws:iam::123456789012:role/app \
--action-names s3:GetObject --resource-arns arn:aws:s3:::acme-data/x.csv
The simulator does not model every resource policy or condition context key, so confirm with a real call in a sandbox.
More on IAM Advanced, STS and Multi-Account
Explain the IAM policy evaluation logic.AdvancedHow does cross-account access evaluation differ from same-account?AdvancedHow does `sts:AssumeRole` work, step by step?IntermediateWhat is the difference between AssumeRole, AssumeRoleWithWebIdentity and AssumeRoleWithSAML?IntermediateWhat is a permission boundary and when would you use one?IntermediateWhat do Service Control Policies do and not do?Intermediate