A SysOps administrator is configuring a secure global content delivery network using Amazon CloudFront and Amazon S3. The S3 bucket contains sensitive assets encrypted using Server-Side Encryption with AWS KMS customer managed keys (SSE-KMS). The administrator sets up a CloudFront distribution and configures Origin Access Control (OAC) to restrict access to the S3 bucket. A bucket policy is applied to the S3 bucket that allows the CloudFront service principal cloudfront.amazonaws.com to perform s3:GetObject on the bucket. However, when test users attempt to download objects via CloudFront, they receive a 403 Forbidden error.
Which of the following configuration changes is required to resolve this error?
- Update the KMS key policy of the customer managed key to grant the CloudFront service principal permission to perform the kms:Decrypt action, using a condition to restrict access to the distribution ARN.Answer
- BModify the S3 bucket policy to include the kms:Decrypt action in the statement that grants access to the CloudFront Origin Access Control.
- CMigrate the origin configuration from Origin Access Control (OAC) to an Origin Access Identity (OAI), as OAIs support automated SSE-KMS decryption without custom key policies.
- DConfigure an IAM role with the kms:Decrypt and s3:GetObject permissions, attach this role to the CloudFront distribution configuration, and update the KMS key to trust the role.
Answer
Update the KMS key policy of the customer managed key to grant the CloudFront service principal permission to perform the kms:Decrypt action, using a condition to restrict access to the distribution ARN.
The correct answer is to update the KMS key policy of the customer managed key to grant the CloudFront service principal permission to perform the kms:Decrypt action, using a condition to restrict access to the distribution ARN. This is because when CloudFront OAC accesses S3 objects encrypted with SSE-KMS, the CloudFront service principal (cloudfront.amazonaws.com) needs the kms:Decrypt permission to decrypt the objects on behalf of the viewer. The permissions must be defined in the KMS key policy of the Customer Managed Key (CMK), restricted to the specific distribution ARN using a condition block for security.
Step-by-Step Solution
Key Concept
CloudFront OAC integration with KMS-encrypted S3 origins