DOP-C02 Security and Compliance Practice Question
A DevOps engineer needs to restrict access to an S3 bucket so that only users from a specific AWS account can read objects. Which TWO methods can achieve this?
⚠ Common exam trap
Many exam-takers confuse bucket ACLs (Option E) with bucket policies, thinking ACLs can restrict access to a specific account, but ACLs only grant access to the entire account (not individual users) and lack the condition keys needed for fine-grained 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
✓
Create an IAM role in the source account with read access to the bucket, and allow users in that account to assume the role.
An IAM role in the source account can be granted read access to the S3 bucket via a bucket policy that allows the role's ARN. Users in the source account assume this role, which temporarily provides them with the necessary permissions to read objects. This cross-account access pattern is secure and follows AWS best practices for delegating access across accounts.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Create an IAM role in the source account with read access to the bucket, and allow users in that account to assume the role.
Why this is correct
Creating an IAM role in the source account with read access to the bucket, and allowing users in that account to assume the role, grants cross-account access by using the role as the principal identity. This approach leverages AWS STS trusts so the bucket policy can restrict the principal to the role's ARN, ensuring only users who assume that role can list and read objects. It avoids permanent cross-account credentials and gives you central control over who may assume the role.
- ✗
Enable S3 Block Public Access on the bucket.
Why it's wrong here
Enabling S3 Block Public Access on the bucket is a protective measure that prevents public exposure, but it does not restrict access to a specific AWS account. It only disables public bucket policies and ACLs; it does not evaluate the source account of IAM principals. Legitimate cross-account requests, even from an allowed account, are unaffected by Block Public Access unless the policy itself is public. Therefore, it cannot serve as an access-control mechanism to limit access to a particular account.
- ✗
Generate pre-signed URLs for each object and distribute them only to users in the target account.
Why it's wrong here
Pre-signed URLs provide temporary, time-limited access to a specific S3 object, but the URL itself is the only credential—anyone who possesses it can download the object, regardless of their AWS account. The signature does not bind the request to a particular account or identity; it is based on the signer's credentials. Thus this method cannot enforce a restriction to a specific target account; it only controls the duration and scope of the URL. This makes it unsuitable for limiting access to a designated account.
- ✓
Write a bucket policy that uses the aws:SourceAccount condition to allow access only from the specific account.
Why this is correct
A bucket policy using the aws:SourceAccount condition key restricts access to requests whose source account matches the specified account ID, so only IAM principals controlled by that account can pass the policy evaluation. This condition is commonly paired with aws:SourceArn to protect against the confused deputy problem, and it provides a direct, resource-based way to enforce cross-account access. Because the policy is evaluated against the requester's account, it remains an effective and auditable method for restricting the bucket to a specific account.
- ✗
Set a bucket ACL that grants read access to the target account's canonical ID.
Why it's wrong here
Bucket ACLs are a legacy access-control mechanism that allow you to grant permissions to another account's canonical ID, but they lack the granularity and condition support of bucket policies. They cannot restrict based on IAM roles, IP addresses, or source account—only on the canonical ID of the account. Additionally, ACLs are non-transitive and are generally not recommended because they are harder to maintain and audit. For these reasons, using an ACL to grant read access to a target account is not a secure or scalable method to restrict access to a specific account.
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
Go deeper
Related to this question
About these practice questions
One of 1,298 original DOP-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 →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DOP-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 DOP-C02 exam.