Courseiva

DOP-C02 Configuration Management and IaC Practice Question

A company uses AWS CodePipeline to deploy a static website to an S3 bucket. The pipeline has a Source stage (GitHub), a Build stage (CodeBuild), and a Deploy stage (CodeDeploy). The deployment fails intermittently with the error: 'Bucket does not allow ACLs'. The S3 bucket is configured to use the 'bucket-owner-enforced' setting for Object Ownership. The team wants to resolve the failure while maintaining security best practices. What should the team do?

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

✓

Update the CodeDeploy deployment action to use a bucket policy and disable ACLs.

The error occurs because the S3 bucket uses the 'bucket-owner-enforced' Object Ownership setting, which disables ACLs. AWS CodeDeploy's default deployment action attempts to set ACLs on deployed objects, causing the failure. The correct solution is option A: configure the CodeDeploy deployment action to use a bucket policy instead of ACLs. This resolves the error while maintaining security best practices by keeping ACLs disabled. Option B (making the bucket public) is insecure. Option C (adding a CodeBuild step) does not address the root cause. Option D (changing Object Ownership to 'ObjectWriter') re-enables ACLs but is not recommended as it weakens ownership control and does not follow current best practices.

Answer analysis

Option-by-option breakdown

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

  • ✓

    Update the CodeDeploy deployment action to use a bucket policy and disable ACLs.

    Why this is correct

    The CodePipeline S3 deployment action assumes an IAM role and, when ACLs are enabled, attempts to set a canned ACL on each object it uploads. If the bucket denies ACL operations because Object Ownership is set to BucketOwnerEnforced, deployment fails; disabling ACLs in the action and granting the deployment role permissions (s3:PutObject, s3:PutObjectAcl) via a bucket policy provides a robust, secure authorization model. This is the AWS-recommended approach because bucket policies are centrally managed and do not rely on per-object ACLs.

  • ✗

    Make the S3 bucket publicly accessible to allow CodeDeploy to write objects.

    Why it's wrong here

    Making the S3 bucket publicly accessible opens the website bucket to anonymous read and, more importantly, anonymous write if you allow s3:PutObject for everyone. The CodeDeploy/CodePipeline service role cannot automatically write to a public bucket without explicit IAM authorization; public access policies only apply to anonymous principals, not to the authenticated deployment role. This removes all access control and violates least privilege, making it both insecure and an ineffective fix.

  • ✗

    Add a step in CodeBuild to copy the artifacts to the S3 bucket using the AWS CLI.

    Why it's wrong here

    Adding a CodeBuild step to copy artifacts with the AWS CLI sidesteps the S3 deployment action but does not resolve the underlying authorization failure that caused the pipeline to fail. It also introduces a new requirement to attach s3:PutObject permissions to the CodeBuild service role, so you still need a policy fix, and you lose CodePipeline's built-in deployment tracking. This is a workaround that obscures the root cause, not a correction to the deployment configuration.

  • ✗

    Change the Object Ownership setting to 'ObjectWriter' to enable ACLs.

    Why it's wrong here

    Changing Object Ownership to ObjectWriter enables ACLs and makes the account that uploads an object the owner, but it does not grant CodeDeploy's role any permission to bypass the missing bucket policy or ACL. It also re-enables ACLs, which are considered a legacy permission mechanism and can create confusion when cross-account uploads occur. AWS recommends keeping Object Ownership at BucketOwnerEnforced and using bucket policies instead, so this change would be a security regression without fixing the deployment action.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

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

This DOP-C02 question is part of Courseiva's 1,298-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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 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.