Interview Prep/AWS/S3, EBS and EFS

Sharing an EBS snapshot with the DR account fails because it is encrypted with the default `aws/ebs` key.

IntermediateTroubleshootingS3, EBS and EFS
Answer

Likely causes → You cannot share snapshots encrypted with the AWS managed key, because its key policy cannot be changed to grant other accounts.

Diagnose →

aws ec2 describe-snapshots --snapshot-ids snap-0abc --query 'Snapshots[].[Encrypted,KmsKeyId]'
aws kms describe-key --key-id <key-id> --query 'KeyMetadata.KeyManager'   # AWS = managed key

Fix →

  1. Copy the snapshot and re-encrypt it with a customer managed key: aws ec2 copy-snapshot --source-region us-east-1 --source-snapshot-id snap-0abc --encrypted --kms-key-id <cmk-arn>
  2. Allow the DR account in the CMK key policy, then share: aws ec2 modify-snapshot-attribute --snapshot-id snap-0new --attribute createVolumePermission --operation-type add --user-ids 222222222222
  3. In the DR account, copy it again with its own key

Prevent → Set EBS default encryption to a CMK (aws ec2 modify-ebs-default-kms-key-id), or use AWS Backup cross-account copy.

aws All AWS questions Roadmap: AWS core services

More on S3, EBS and EFS