An S3 bucket holds confidential documents. Security requires the bucket to reject every request that does not arrive through the company's S3 gateway endpoint, vpce-1a2b3c4d, even when an IAM policy allows the request. Which configuration meets this requirement?
Show the answer
Correct answerC. Add a bucket policy statement that denies all S3 actions when aws:SourceVpce is not vpce-1a2b3c4d.
AWhy not this: An endpoint policy limits what callers can reach through that endpoint, but it does not stop requests that reach the bucket by another path.
BWhy not this: A conditional Allow adds no restriction when an IAM policy in the same account already allows the request.
CWhy this is right: An explicit Deny for requests from any other source overrides every Allow, including the IAM policy.
DWhy not this: Block Public Access stops public grants but does not reject authenticated requests from outside the endpoint.
An explicit Deny in the bucket policy with a StringNotEquals condition on aws:SourceVpce rejects requests from any other path, and an explicit Deny overrides any IAM Allow. A conditional Allow in the bucket policy does not stop an IAM policy in the same account from granting access over another path.