nerdexam
Amazon

SCS-C02 · Question #95

A security engineer needs to configure an Amazon S3 bucket policy to restrict access to an S3 bucket that is named DOC-EXAMPLE-BUCKET. The policy must allow access to only DOC- EXAMPLE-BUCKET from onl

The correct answer is B. { "Statement": [ { "Sid": "Access-to-specific-VPCE-only", "Principal": "*", "Action": "s3:*", "Effect": "Deny", "Resource": [ "arn:aws:s3:::DOC-EXAMPLE-BUCKET", "arn:aws:s3:::DOC-EXAMPLE-BUCKET/*" ], "Condition": { "StringNotEquals": { "aws:sourceVpce": "vpce-1a2b3c4d" } } } ] }. Option B is correct because it uses Effect: Deny combined with StringNotEquals on aws:sourceVpce. This means any request that does NOT come from vpce-1a2b3c4d will be explicitly denied, effectively blocking all access except through the specified VPC endpoint. In AWS IAM policy e

Submitted by fernanda_arg· Mar 6, 2026Infrastructure Security – Implementing secure access controls for S3 using VPC endpoint restrictions and IAM condition keys (AWS Security Specialty / AWS Solutions Architect)

Question

A security engineer needs to configure an Amazon S3 bucket policy to restrict access to an S3 bucket that is named DOC-EXAMPLE-BUCKET. The policy must allow access to only DOC- EXAMPLE-BUCKET from only the following endpoint: vpce-1a2b3c4d. The policy must deny all access to DOC-EXAMPLE-BUCKET if the specified endpoint is not used. Which bucket policy statement meets these requirements? A. B. C. D.

Exhibits

SCS-C02 question #95 exhibit 1
SCS-C02 question #95 exhibit 2
SCS-C02 question #95 exhibit 3
SCS-C02 question #95 exhibit 4

Options

  • A{ "Statement": [ { "Sid": "Access-to-specific-VPCE-only", "Principal": "", "Action": "s3:", "Effect": "Allow", "Resource": [ "arn:aws:s3:::DOC-EXAMPLE-BUCKET", "arn:aws:s3:::DOC-EXAMPLE-BUCKET/*" ], "Condition": { "StringNotEquals": { "aws:sourceVpce": "vpce-1a2b3c4d" } } } ] }
  • B{ "Statement": [ { "Sid": "Access-to-specific-VPCE-only", "Principal": "", "Action": "s3:", "Effect": "Deny", "Resource": [ "arn:aws:s3:::DOC-EXAMPLE-BUCKET", "arn:aws:s3:::DOC-EXAMPLE-BUCKET/*" ], "Condition": { "StringNotEquals": { "aws:sourceVpce": "vpce-1a2b3c4d" } } } ] }
  • C{ "Statement": [ { "Sid": "Access-to-specific-VPCE-only", "Principal": "", "Action": "s3:", "Effect": "Deny", "Resource": [ "arn:aws:s3:::DOC-EXAMPLE-BUCKET", "arn:aws:s3:::DOC-EXAMPLE-BUCKET/*" ], "Condition": { "StringEquals": { "aws:sourceVpce": "vpce-1a2b3c4d" } } } ] }
  • D{ "Statement": [ { "Sid": "Access-to-specific-VPCE-only", "Principal": "", "Action": "s3:", "Effect": "Allow", "Resource": [ "arn:aws:s3:::DOC-EXAMPLE-BUCKET", "arn:aws:s3:::DOC-EXAMPLE-BUCKET/*" ], "Condition": { "StringEquals": { "aws:sourceVpce": "vpce-1a2b3c4d" } } } ] }

How the community answered

(49 responses)
  • A
    10% (5)
  • B
    63% (31)
  • C
    20% (10)
  • D
    6% (3)

Explanation

Option B is correct because it uses Effect: Deny combined with StringNotEquals on aws:sourceVpce. This means any request that does NOT come from vpce-1a2b3c4d will be explicitly denied, effectively blocking all access except through the specified VPC endpoint. In AWS IAM policy evaluation, an explicit Deny always overrides any Allow, making this the most secure and correct approach to restrict bucket access exclusively to a single VPC endpoint.

Topics

#S3 Bucket Policy#VPC Endpoints#IAM Policy Conditions#Data Perimeter Security

Community Discussion

No community discussion yet for this question.

Full SCS-C02 Practice