Courseiva

SCS-C02 Identity and Access Management Practice Question

A company is using IAM roles to grant EC2 instances access to an S3 bucket. The security team wants to ensure that the instances can only access their own bucket. Which policy should be attached to the IAM role to enforce this?

⚠ Common exam trap

The trap is picking a policy that 'looks' scoped (e.g., with an IP condition) but still uses Resource:* — the exam tests whether you verify the Resource element, not just the presence of a Condition.

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

✓

{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"s3:GetObject","Resource":"arn:aws:s3:::my-bucket/*"}]}

Option D is the only policy that scopes the Allow to a specific bucket ARN (arn:aws:s3:::my-bucket/*), which enforces least privilege by ensuring the role can only access objects in that one bucket. The other options either grant wildcard access or use conditions that do not restrict the resource to the instance's own bucket.

Answer analysis

Option-by-option breakdown

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

  • ✗

    {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"s3:*","Resource":"*"}]}

    Why it's wrong here

    This statement is dangerously over-permissive: it allows every S3 API action (s3:*) against every S3 resource in the account. A read-only requirement for a single bucket is completely unmet because the IAM policy would let an attacker or compromised instance list, write, delete, and even change bucket policies or object ACLs across all buckets. Least privilege demands that the action be limited to s3:GetObject and the resource be scoped to arn:aws:s3:::my-bucket/*, not a blanket s3:* on *.

  • ✗

    {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"s3:GetObject","Resource":"*"}]}

    Why it's wrong here

    Although this improves on s3:* by only permitting the s3:GetObject action, the Resource is still "*", which means the role can read objects from any bucket in the account—and in any other account that has granted the necessary cross-account permissions. The requirement is to restrict access to objects in the specific bucket my-bucket, so the resource ARN must be scoped to arn:aws:s3:::my-bucket/*. An IAM policy with Resource "*" fails the principle of least privilege and exposes every object the role can reach, not just the intended bucket.

  • ✗

    {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"s3:GetObject","Resource":"*","Condition":{"IpAddress":{"aws:SourceIp":"10.0.0.0/16"}}}]}

    Why it's wrong here

    The use of aws:SourceIp in an IAM role policy is ineffective because the condition is evaluated against the source IP of the principal making the request—and when an EC2 instance assumes a role, the API call originates from the instance's private or public IP, but the role's credentials are used by the instance, not by the IP itself. More fundamentally, IAM role policies cannot use aws:SourceIp reliably for EC2 because the source IP seen by S3 is the IP of the client making the request, which could be a NAT gateway, load balancer, or VPC endpoint, not the instance's IP. Additionally, the Resource is still "*", so even if the IP condition were valid, it would still grant GetObject on all buckets, not just my-bucket. The correct approach is to scope the Resource to the target bucket's objects and, if network-level control is needed, place the IP condition on the S3 bucket policy (or use a VPC endpoint condition) instead.

  • ✓

    {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"s3:GetObject","Resource":"arn:aws:s3:::my-bucket/*"}]}

    Why this is correct

    This is the correct least-privilege policy: it restricts the s3:GetObject action to a specific Resource ARN, arn:aws:s3:::my-bucket/*, which matches only objects inside the my-bucket bucket. The lack of s3:ListBucket permission is fine for direct object retrieval—the caller must know the object key, but that matches the requirement of granting access to the bucket's objects. The policy contains no wildcards beyond the object-name segment (*), so it does not grant access to other buckets or to bucket-level operations like listing. This scoping aligns with AWS's recommended practice of using resource-level permissions for S3 actions and is the only option that satisfies the principle of least privilege.

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

One of 1,205 original SCS-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Amazon Web Services exam blueprint

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.