Courseiva
SDLC AutomationmediumMultiple ChoiceObjective-mapped

DOP-C02 SDLC Automation Practice Question

Exhibit

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:PutObject"
      ],
      "Resource": "arn:aws:s3:::my-codepipeline-bucket/*"
    },
    {
      "Effect": "Allow",
      "Action": [
        "codebuild:StartBuild",
        "codebuild:BatchGetBuilds"
      ],
      "Resource": "*"
    },
    {
      "Effect": "Allow",
      "Action": "iam:PassRole",
      "Resource": "arn:aws:iam::123456789012:role/CodeBuildServiceRole",
      "Condition": {
        "StringEquals": {
          "iam:PassedToService": "codebuild.amazonaws.com"
        }
      }
    }
  ]
}

Refer to the exhibit. An IAM policy is attached to a CodePipeline service role. When the pipeline tries to start a CodeBuild project, it fails with an 'AccessDenied' error. The CodeBuild project uses a different service role (arn:aws:iam::123456789012:role/CodeBuildServiceRole2). What is the MOST likely cause?

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

The policy only allows iam:PassRole for a specific role ARN, but the CodeBuild project uses a different role.

The pipeline's service role has an iam:PassRole action constrained to a specific role ARN via a condition key. When the pipeline attempts to start the CodeBuild project, it needs to pass the CodeBuild service role (arn:aws:iam::123456789012:role/CodeBuildServiceRole2) to CodeBuild. Because the policy only allows iam:PassRole for a different role (not this one), the pass fails, resulting in an AccessDenied error. Option D correctly identifies this issue.

Answer analysis

Option-by-option breakdown

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

  • The policy has a condition on the s3 actions that is not satisfied.

    Why it's wrong here

    No condition on s3 actions.

  • The policy does not allow codebuild:StartBuild for the specific project.

    Why it's wrong here

    The policy allows codebuild:StartBuild on all resources.

  • The policy does not allow s3:GetObject on the artifact bucket.

    Why it's wrong here

    It does allow s3:GetObject on the bucket.

  • The policy only allows iam:PassRole for a specific role ARN, but the CodeBuild project uses a different role.

    Why this is correct

    The PassRole action is restricted to a specific role ARN.

About these practice questions

One of 1,013 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 →

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.