- Newest
- Most votes
- Most comments
Hello.
I suspect the root cause is a kms:CreateGrant denial issued by the AWSServiceRoleForBackup on the destination side. You should specifically verify the conditions if a custom EncryptionContextSubset condition has been added to the destination key policy.
The documentation for cross-account snapshot copying for RDS/Aurora itself explicitly states that, for encrypted snapshots, the source KMS key policy must grant kms:CreateGrant permission to the destination account.
I recommend starting with a slightly broader KMS key policy, and once it works, gradually adding conditions to restrict it while testing.
https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_CopyDBClusterSnapshot.CrossAccount.html
Is the omission of requestParameters on CreateGrant AccessDenied events for a service-linked role such as AWSServiceRoleForBackup expected CloudTrail behavior? If so, what is the supported way for a customer to obtain the denied request detail (target key, grantee principal, requested operations, grant constraints, evaluated kms:ViaService)?
I searched the AWS documentation, but I couldn't find any mention of the specification where requestParameters are omitted due to an AccessDenied error involving AWSServiceRoleForBackup.
The destination key policy already grants the data-key generation and CreateGrant KMS actions and constrained kms:CreateGrant to the destination AWSServiceRoleForBackup, only through rds in the home region, with GrantIsForAWSResource and EncryptionContextSubset conditions. For an Aurora cross-account copy, should that CreateGrant grant be on the destination vault key, the source cluster key, or both? Which key does AWSServiceRoleForBackup call CreateGrant against during this operation?
Both KMS keys could be involved, but without checking details such as resources[].ARN in CloudTrail, it is impossible to definitively determine which key the CreateGrant call—issued by the destination account's AWSServiceRoleForBackup—is targeting.
Three things that should get this unstuck faster.
0. The empty source trail doesn't clear the source key. The KMS CloudTrail docs say cross-account KMS operations are logged in both accounts, but cross-account requests rejected because access is denied are logged only in the caller's account. The caller here is the destination AWSServiceRoleForBackup. If the source cluster key's policy denied the grant, you would see exactly what you see: AccessDenied for CreateGrant in the destination trail and nothing in the source trail. Both keys are still suspects. Your source-side Decrypt/GenerateDataKey events only prove the local backup path works.
1. The denied event usually tells you which key. Even when requestParameters is missing, check these fields on the two AccessDenied events (CloudTrail Lake, or aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=CreateGrant in us-east-2, destination account):
errorMessageresources[]sourceIPAddress/userAgent, which show which service made the call on the role's behalf
IAM access-denied messages follow the form User: <principal> is not authorized to perform: kms:CreateGrant on resource: <key ARN> because no <type> policy allows the kms:CreateGrant action. The account ID in the key ARN answers "source or destination key". The "<type>" tells you whether a key policy, an identity policy or an SCP denied it. IAM notes that some services don't return this extended format. If yours doesn't, the KMS key ARN in resources[] still answers the first question.
2. Which key gets CreateGrant during an Aurora cross-account copy. For RDS/Aurora, the copy is not a byte copy done inside AWS Backup. The source account shares the snapshot, then the destination account's AWSServiceRoleForBackup runs an RDS snapshot copy that re-encrypts with the destination vault key. That RDS copy creates grants on both keys:
- Source cluster key (source account): its key policy must allow the destination account (or its
AWSServiceRoleForBackup)kms:CreateGrant,kms:Decrypt,kms:DescribeKeyandkms:ReEncrypt*, viards.us-east-2.amazonaws.com. This is the same requirement as a manual cross-accountCopyDBClusterSnapshot. - Destination vault key (destination account): your current policy, plus
kms:GenerateDataKey*andkms:ReEncrypt*.
Likely culprits in your destination key policy: the conditions, not the action list.
kms:ViaServicelimited to RDS. The AWS Backup encryption docs' sample CreateGrant statement uses"kms:ViaService": "backup.*.amazonaws.com"and"kms:EncryptionContextKeys": "aws:backup:backup-vault", not RDS. If some of the copy's grants are requested through AWS Backup itself rather than RDS, an rds-onlyViaServicedenies them.sourceIPAddresson the denied events shows which service was calling. Allowing bothrds.us-east-2.amazonaws.comandbackup.us-east-2.amazonaws.comis a cheap test.EncryptionContextSubset. The context on the grants created during the copy often isn't the one people expect. Test without it, keepingkms:GrantIsForAWSResource(which already limits grants to ones an AWS service creates for an AWS resource). Once the copy succeeds, put the context condition back with the values you see in the successfulCreateGrantevent.
Also check both key policies for any Deny statement. The AWS Backup docs call out explicit denies and revoked grants as the two usual causes of failed jobs.
Isolation test:
- Share one snapshot from the source account manually.
- In the destination account, run
aws rds copy-db-cluster-snapshot --source-db-cluster-snapshot-identifier <shared-arn> --target-db-cluster-snapshot-identifier test-copy --kms-key-id <destination-vault-key-arn>as an admin principal.
If that works, both key policies are fine for humans and the problem is in the conditions scoped to the service-linked role. If it fails, the error comes back synchronously, with the key in the message.
References:
- Cross-account copy of encrypted Aurora snapshots: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_CopyDBClusterSnapshot.CrossAccount.html
- AWS Backup cross-account copies: https://docs.aws.amazon.com/aws-backup/latest/devguide/create-cross-account-backup.html
- KMS CloudTrail logging (denied cross-account requests are logged only in the caller account): https://docs.aws.amazon.com/kms/latest/developerguide/logging-using-cloudtrail.html
- AWS Backup encryption, required key permissions and sample CreateGrant conditions: https://docs.aws.amazon.com/aws-backup/latest/devguide/encryption.html
- IAM access denied message format: https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_access-denied.html
answered 9 days ago
Relevant content
asked 2 years ago
asked 3 years ago
- AWS OFFICIALUpdated a year ago
