Interview Prep/AWS/IAM Best Practices

What does a good trust policy for cross-account access look like?

IntermediateProductionIAM Best Practices
Answer

Trust a specific role ARN, not the whole account root, unless you deliberately delegate the decision to the other account's admins. Add conditions such as aws:PrincipalOrgID, MFA for humans, and sts:ExternalId for third parties.

{
  "Effect": "Allow",
  "Principal": {"AWS": "arn:aws:iam::444455556666:role/ci-deployer"},
  "Action": ["sts:AssumeRole", "sts:TagSession"],
  "Condition": {"StringEquals": {"aws:PrincipalOrgID": "o-abc123xyz"}}
}
aws All AWS questions Roadmap: AWS core services

More on IAM Best Practices