A cross-account role assumption fails with AccessDenied even though the target role trusts the source account. What do you check?
IntermediateScenarioIAM, Organizations and Multi-Account
Answer
Situation read → Both sides must allow it: the target trust policy and an identity policy on the caller granting sts:AssumeRole.
What I'd do →
- Check the role's trust policy principal and any
Conditionsuch assts:ExternalIdoraws:PrincipalOrgID - Check the caller's identity policy allows
sts:AssumeRoleon the exact role ARN - Check no SCP or permissions boundary blocks it
- Retry:
aws sts assume-role --role-arn arn:aws:iam::222222222222:role/deploy --role-session-name testand read the error text
Why → Cross-account needs an allow on both sides, whereas same-account trust can be satisfied by one.
Interview tip → Mention that a trust principal of the account root only delegates; the caller still needs its own allow.
More on IAM, Organizations and Multi-Account
A developer needs read-only access to one S3 bucket from their laptop. How do you grant it without creating long-lived access keys?BeginnerAn EC2 application needs to write to DynamoDB. Where do the credentials come from?BeginnerSecurity wants to know who deleted a production S3 bucket yesterday. How do you find out?BeginnerYou must stop anyone in a member account from disabling CloudTrail, even account admins. What do you use?BeginnerDesign access for a CI pipeline in GitHub Actions to deploy to AWS without storing AWS keys in GitHub.IntermediateHow would you let developers create IAM roles for their apps without letting them escalate to admin?Intermediate