Courseiva
Infrastructure Security →mediumMultiple Select

SCS-C02 Infrastructure Security Practice Question

Which TWO actions are valid ways to restrict access to an Amazon S3 bucket using a bucket policy? (Choose two.)

⚠ Common exam trap

The SCS-C02 exam often tests the distinction between `aws:SourceVpce` (for VPC endpoints) and `aws:SourceVpc` (for VPC-level restrictions), and candidates mistakenly choose `aws:SourceVpce` when the question asks for VPC-wide access control.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Use the aws:SourceIp condition key to allow access only from a specific IP range.

The `aws:SourceIp` condition key in an S3 bucket policy allows you to restrict access based on the requester's IP address. This is a standard AWS IAM condition that evaluates the source IP of the request, enabling you to permit or deny access from a specific CIDR range. It is commonly used to limit S3 bucket access to a corporate network or a known set of public IPs.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    Use the aws:SourceIp condition key to allow access only from a specific IP range.

    Why this is correct

    The aws:SourceIp condition key is a global condition key that can be used in an S3 bucket policy's Condition block with the IpAddress operator to allow access only from a specific public IP range, such as a corporate egress CIDR. This is valid because S3 evaluates the requester's IP address for most API calls, though it does not apply when the request is made through a VPC endpoint, in which case the source IP is from the endpoint itself.

  • ✗

    Use the iam:RoleName condition key to allow access only from a specific IAM role.

    Why it's wrong here

    There is no iam:RoleName condition key recognized in S3 bucket policies; AWS condition keys for principals are documented under the aws:Principal* namespace, such as aws:PrincipalArn, aws:PrincipalTag, or aws:PrincipalType. While you can restrict a bucket policy by role using the Principal element or by matching the role's unique ID with aws:userId, the iam:RoleName key itself is not evaluated by S3 and would cause the policy to fail or not behave as intended.

  • ✓

    Use the aws:Referer condition key to allow access only from a specific HTTP referer.

    Why this is correct

    The aws:Referer condition key is a valid global condition key that restricts access based on the HTTP Referer header included in the request, which is commonly used to prevent hotlinking of S3 objects hosted on a website. However, because the Referer header can be spoofed by an attacker, it should only be used as a lightweight access control for public content, not as a security boundary protecting confidential data.

  • ✗

    Use the aws:SourceVpce condition key to allow access only from a specific VPC.

    Why it's wrong here

    The aws:SourceVpce condition key matches a specific VPC endpoint ID (vpce-xxxxxxxx) and is meant to allow access only from that endpoint, not from the VPC as a whole. To restrict access based on the entire VPC, you need the aws:SourceVpc condition key with the VPC ID (vpc-xxxxxxxx); confusing these two keys is a common mistake in S3 bucket policy design.

  • ✗

    Use the kms:EncryptionContext condition key to require that objects are encrypted with a specific KMS key.

    Why it's wrong here

    The kms:EncryptionContext condition key is intended for use in KMS key policies or IAM policies that control KMS actions like kms:Decrypt, not in S3 bucket policies, where S3-specific condition keys such as s3:x-amz-server-side-encryption-aws-kms-key-id are used to require a particular KMS key. While encryption context can be evaluated by KMS when authorizing cryptographic operations, an S3 bucket policy has no access to the kms:EncryptionContext condition key to gate s3:GetObject access.

Visual reference

Source Router + ACL permit 10.0.0.0/8 deny any Server 10.0.0.5 ✓ 192.168.1.1 ✗ dropped ACLs evaluate top-down; first match wins — implicit deny all at end

Quick reference

AWS S3 Storage Class Comparison

Storage ClassMin DurationRetrievalUse Case
S3 StandardNoneImmediateFrequently accessed data
S3 Standard-IA30 daysImmediateInfrequent access, rapid retrieval
S3 One Zone-IA30 daysImmediateNon-critical infrequent data
S3 Intelligent-TieringNoneImmediate–hoursUnknown or changing access patterns
S3 Glacier Instant90 daysMillisecondsArchive with instant retrieval
S3 Glacier Flexible90 daysMinutes–hoursArchive, flexible retrieval
S3 Glacier Deep Archive180 daysHoursLong-term compliance archive

About these practice questions

Courseiva writes every SCS-C02 question from scratch — 1,205 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This SCS-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SCS-C02 exam.