DOP-C02 Security and Compliance Practice Question
Which TWO actions can be taken to protect an S3 bucket from being publicly accessible? (Select TWO.)
⚠ Common exam trap
Test-takers frequently confuse security features like encryption or MFA Delete with access control mechanisms, failing to recognize that only explicit policy restrictions (SCP or Block Public Access) can prevent public accessibility.
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 an SCP to deny s3:PutBucketPolicy.
An SCP (Service Control Policy) can explicitly deny the s3:PutBucketPolicy action at the AWS Organizations level, which prevents any IAM principal in affected accounts from attaching a public bucket policy. This is a preventive guardrail that overrides any permissive IAM permissions, ensuring the bucket cannot be made publicly accessible via policy statements.
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 an SCP to deny s3:PutBucketPolicy.
Why this is correct
An SCP (Service Control Policy) is a preventive guardrail applied at the AWS Organizations level, and it can deny the s3:PutBucketPolicy action for all IAM principals within an account or OU. This ensures that even if a user has an IAM policy granting s3:PutBucketPolicy, they cannot attach a bucket policy that would grant public access, because the SCP takes precedence. It is an effective way to enforce a 'no public buckets' rule across the entire organization.
- ✗
Enable default encryption on the bucket.
Why it's wrong here
Default encryption (SSE-S3 or SSE-KMS) only applies to the data at rest inside the bucket; it encrypts objects as they are written but does nothing to alter the bucket's permission model. A bucket with a public policy or public ACL will still let anonymous users list and read objects, regardless of encryption. Encryption protects the data if an attacker gains access to the storage medium, but it doesn't prevent unauthorized access in the first place, so it's not a protection against making the bucket public.
- ✓
Enable S3 Block Public Access settings on the bucket.
Why this is correct
S3 Block Public Access is a bucket-level or account-level setting that explicitly overrides any policy or ACL that would grant public access. When enabled, the s3:PutBucketPolicy operation will be rejected for any policy that contains a Principal of '*' or a public IP, and existing public access is also blocked at the S3 service level. This is the most direct and effective built-in way to prevent a bucket from being exposed publicly, as it works regardless of what other IAM or bucket policies might allow.
- ✗
Enable MFA Delete on the bucket.
Why it's wrong here
MFA Delete is a versioning feature that requires an additional authentication factor (a hardware or virtual MFA token) to permanently delete an object version or suspend versioning on a bucket. It is designed to protect against accidental or malicious deletion, not to control access to the data. A bucket can still be configured with a public bucket policy or ACL while MFA Delete is enabled, meaning anonymous users can read or write objects, so it does nothing to prevent public access.
- ✗
Use CloudFront to serve the bucket content.
Why it's wrong here
Simply making a bucket an origin for CloudFront does not automatically change the bucket's permissions; if the bucket policy still allows public access, users can bypass CloudFront and access the S3 origin directly. To secure the bucket, you typically use CloudFront Origin Access Control (OAC) or an Origin Access Identity (OAI) to restrict bucket access to only the CloudFront distribution, and you must also remove any public access from the bucket policy. Without that additional configuration, CloudFront merely provides caching and delivery, not access protection.
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,487 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 →
Same concept, more angles
1 more way this is tested on DOP-C02
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. Which TWO actions should a DevOps engineer take to prevent an S3 bucket from being publicly accessible? (Choose two.)
medium- A.Enable S3 Versioning on the bucket.
- ✓ B.Enable S3 Block Public Access at the bucket level.
- C.Enable S3 Server Access Logging.
- ✓ D.Configure a bucket policy that explicitly denies anonymous access.
- E.Configure a lifecycle policy to delete objects.
Why B: Enabling S3 Block Public Access at the bucket level provides a centralized, override-proof mechanism to prevent any public access to the bucket, regardless of other policies or ACLs. This setting blocks all public access by default, including access granted via bucket policies, access control lists (ACLs), or object-level permissions, and cannot be overridden by any other S3 configuration.
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.