An S3 bucket policy must reject any request that does not use HTTPS, and must reject any upload that is not encrypted with one specific customer managed AWS KMS key. Which bucket policy statements meet both requirements?
Show the answer
Correct answerB. Deny s3:* when aws:SecureTransport is false, and deny s3:PutObject when s3:x-amz-server-side-encryption-aws-kms-key-id is not the key's ARN.
AWhy not this: Allow statements do not stop requests that other policies allow, and the encryption header check accepts any KMS key.
BWhy this is right: Explicit denies override any allow, and the key-ID condition rejects uploads that name another key or no key.
CWhy not this: This enforces HTTPS and SSE-KMS but still accepts uploads encrypted with any other KMS key.
DWhy not this: Plain HTTP requests carry no TLS version, so the deny never matches them, and default encryption does not stop a request that names a different key.
Explicit deny statements override any allow. Denying all S3 actions when aws:SecureTransport is false blocks plain HTTP, and denying s3:PutObject when s3:x-amz-server-side-encryption-aws-kms-key-id does not equal the key's ARN rejects uploads that use another key or omit the header, so clients must name the required key. Checking only s3:x-amz-server-side-encryption accepts any KMS key.