AWS Certified Security - Specialty free question 5 / 10 · Domain 3: Infrastructure Security
Objects in an S3 bucket served through an OAC are encrypted with SSE-KMS, and the bucket policy is configured correctly. Which statement matches the official example for what to add to the KMS key policy so that viewers can read the objects?
- Set Principal to s3.amazonaws.com, and set the Condition AWS:SourceArn to the bucket's ARN
- Set Principal to s3.amazonaws.com, and set the Condition AWS:SourceArn to the distribution's ARN
- Set Principal to cloudfront.amazonaws.com, and set the Condition AWS:SourceArn to the distribution's ARN
- Set Principal to cloudfront.amazonaws.com, and set the Condition AWS:SourceArn to the bucket's ARN
Show the answer and explanation
Answer: C
Why this is correct
When objects in an S3 origin are encrypted with SSE-KMS, you need to allow the CloudFront distribution to use the AWS KMS key, and you do that by adding a statement to the key policy. The statement in the official example sets the Service in Principal to cloudfront.amazonaws.com, allows kms:Decrypt, kms:Encrypt and kms:GenerateDataKey, and uses a StringEquals Condition to limit AWS:SourceArn to that distribution's ARN.
Why the other options are wrong
"Set Principal to s3.amazonaws.com, and set the Condition AWS:SourceArn to the distribution's ARN" … The party you grant permission to use the key is the CloudFront distribution, so the Principal in the key policy is the cloudfront.amazonaws.com service principal.
"Set Principal to cloudfront.amazonaws.com, and set the Condition AWS:SourceArn to the bucket's ARN" … In the official example, AWS:SourceArn holds the CloudFront distribution's ARN (arn:aws:cloudfront::111122223333:distribution/<CloudFront distribution ID>).
"Set Principal to s3.amazonaws.com, and set the Condition AWS:SourceArn to the bucket's ARN" … Both parts are wrong. The Principal in the official example is the cloudfront.amazonaws.com service principal, and AWS:SourceArn holds the CloudFront distribution's ARN, not the bucket's.
Key point
When you use an S3 Multi-Region Access Point as the CloudFront origin, a different OAC configuration is needed. When you delete a distribution that has an S3 origin with an OAC, delete the distribution before the S3 bucket. If you cannot, include the Region in the origin domain name, or switch to public and remove the OAC before deleting.