A cross-account decrypt fails: `AccessDeniedException: The ciphertext refers to a customer master key that does not exist, does not exist in this region, or you are not allowed to access it.`
AdvancedTroubleshootingCloudFormation, CloudWatch, KMS, Secrets and Cost
Answer
Likely causes → One of three: (1) the key is in another Region, because KMS keys are Regional unless multi-Region, (2) the key policy in the owning account does not allow the caller's account or role, or (3) the caller's IAM policy has no kms:Decrypt on the key ARN. Cross-account access needs both the key policy and IAM. The error deliberately does not say which one failed.
Diagnose →
aws kms describe-key --key-id arn:aws:kms:us-east-1:222222222222:key/abcd... --query 'KeyMetadata.[Arn,KeyState,MultiRegion]'
aws kms get-key-policy --key-id <arn> --policy-name default --output text # run in owning account
aws iam simulate-principal-policy --policy-source-arn <caller-role-arn> --action-names kms:Decrypt --resource-arns <key-arn>
Fix →
- Add a key policy statement allowing
arn:aws:iam::111111111111:role/consumerto usekms:Decryptandkms:DescribeKey - Add a matching IAM allow on the consumer role, referencing the key ARN (not an alias)
- Call KMS in the key's Region, or use a multi-Region replica
Prevent → Template cross-account key grants, and use encryption context conditions to scope them.
More on CloudFormation, CloudWatch, KMS, Secrets and Cost
Updating a stack fails: `Stack:arn:aws:cloudformation:...:stack/app/... is in ROLLBACK_COMPLETE state and can not be updated.`BeginnerA stack is stuck in `UPDATE_ROLLBACK_FAILED`.AdvancedA pipeline fails with `An error occurred (ValidationError) when calling the UpdateStack operation: No updates are to be performed.`Beginner`InsufficientCapabilitiesException: Requires capabilities : [CAPABILITY_NAMED_IAM]`.BeginnerStack deletion ends in `DELETE_FAILED` with `The bucket you tried to delete is not empty` on an S3 bucket resource.IntermediateDrift detection shows `MODIFIED` on a security group and an RDS instance that someone changed in the console. How do you reconcile?Advanced