Debugging "AccessDenied" step by step
When AWS denies a request, the cause is in one of seven places. The simulator checks them in the same order AWS does, and the flowchart shows where the request stopped. Here is how to use each part.
1. Enter the real caller
The result depends on who is calling. A role in the same account, a role in another account, an IAM user, an AWS service and an anonymous caller are all treated differently. Use the ARN AWS actually sees:
- a role session:
arn:aws:sts::111122223333:assumed-role/AppRole/session; - an IAM user:
arn:aws:iam::111122223333:user/alice; - a service name, such as
s3.amazonaws.com; *for anonymous.
If the resource ARN has no account ID (S3 buckets, for example), enter the bucket owner's account, so the simulator can tell whether the request is cross-account.
2. Add every policy that applies
In Multi-Layer mode you can paste:
- the identity policy;
- the resource policy (bucket, queue, key or trust policy);
- SCPs and RCPs from AWS Organizations;
- a permissions boundary;
- a session policy.
To load a real user or role, go to Import from AWS and load the output of aws iam get-account-authorization-details. It combines inline, managed and group policies, and adds the permissions boundary. The file never leaves your browser.
3. Set the request context
Conditions decide most real-world denials. The key helper suggests keys for the action you typed. Some keys are filled in automatically, as AWS does: aws:PrincipalArn, aws:PrincipalAccount, aws:username for IAM users, and aws:CurrentTime. Keys that can hold several values, such as aws:TagKeys, take a JSON list: ["env","team"].
4. Read the result
- Explicit deny: a Deny statement matched. Nothing can override it, so change the Deny or add a condition that excludes this request.
- Implicit deny: nothing allowed the request. How to fix it shows the smallest statement that would allow it and where it belongs, and can add it and re-run.
- Cross-account: both sides must allow it — the caller's identity policy and the resource policy.
- Trust and KMS key policies must allow the caller explicitly, even in the same account.
5. Keep it working
Use Matrix to test many actions, resources and callers at once, and download the results as CSV. Save important expectations in the Test suite (for example, "the app role cannot delete the bucket"), and re-run them after every policy change. Share a link that holds the whole setup; the policies travel in the link after #, so share it only with people allowed to see them.