`AccessDenied` with message `explicit deny in a resource-based policy` for a KMS decrypt in a cross-account pipeline.
AdvancedTroubleshootingIAM and Access Errors
Answer
Likely causes → The key policy lacks the caller or has a deny condition on kms:ViaService or encryption context.
Diagnose →
aws kms get-key-policy --key-id <key> --policy-name default
aws kms list-grants --key-id <key>
aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=Decrypt
Fix →
- Add the role ARN to the key policy or a grant
- Add the identity policy allow for
kms:Decrypt - Check encryption context
Prevent → Review key policies when granting cross-account S3 or EBS access.
More on IAM and Access Errors
`An error occurred (AccessDenied) when calling the ListBuckets operation: Access Denied` for a user who has S3 read access. What is wrong?Beginner`ExpiredToken: The security token included in the request is expired` in a long CI job. How do you fix it?Beginner`User: arn:aws:sts::111111111111:assumed-role/dev/bob is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::222222222222:role/deploy`. Why?Intermediate`An error occurred (AccessDenied) ... because no identity-based policy allows the s3:GetObject action` yet a bucket policy allows the user. Cross-account?IntermediateIAM policy validation: `MalformedPolicyDocument: Policy document should not specify a principal`. What happened?Intermediate`The security token included in the request is invalid` when using `aws` CLI.Beginner