Courseiva
Back to AWS Certified DevOps Engineer Professional DOP-C02 questions

Scenario-based practice

Refer to the Exhibit Practice Questions

Practise AWS Certified DevOps Engineer Professional DOP-C02 practice questions — original exam-style scenarios covering every exam domain, with detailed explanations, wrong-answer analysis, and common exam traps.

15
scenario questions
DOP-C02
exam code
Amazon Web Services
vendor

Scenario guide

How to approach refer to the exhibit practice questions

Practise exhibit-style questions that ask you to read a topology, table, command output or diagram before choosing the best answer.

Quick answer

Exhibit-style questions test whether you can read a topology, command output, diagram or table before choosing the best answer.

How to extract the relevant detail from an exhibit.

How topology, command output or routing information affects the answer.

How to avoid answering from memory before reading the evidence.

How to map the exhibit back to the exam objective.

Related practice questions

Related DOP-C02 topic practice pages

Scenario questions usually connect to one or more exam topics. Use these links to review the underlying concepts behind the scenario.

Practice set

Practice scenarios

Question 1mediummultiple choice
Full question →

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?

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"
        }
      }
    }
  ]
}
Question 2easymultiple choice
Full question →

Refer to the exhibit. The IAM policy above is attached to a Lambda function's execution role. The Lambda function is supposed to publish custom metrics to CloudWatch using PutMetricData. However, the metrics are not appearing. What is the most likely reason?

Exhibit

Refer to the exhibit.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "cloudwatch:PutMetricData",
        "cloudwatch:GetMetricStatistics",
        "cloudwatch:ListMetrics"
      ],
      "Resource": "*"
    }
  ]
}
Question 3easymultiple choice
Full question →

The exhibit shows a CloudFormation stack event. The stack creation failed with 'Resource creation cancelled'. What is the most likely reason for this cancellation?

Network Topology
$ aws cloudformation describe-stack-eventsstack-name my-stackRefer to the exhibit.```"StackEvents": ["StackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/my-stack/abc123","EventId": "Event-1","StackName": "my-stack","LogicalResourceId": "my-stack","PhysicalResourceId": "arn:aws:cloudformation:us-east-1:123456789012:stack/my-stack/abc123","ResourceType": "AWS::CloudFormation::Stack","Timestamp": "2023-01-01T00:00:00Z","ResourceStatus": "CREATE_FAILED","ResourceStatusReason": "Resource creation cancelled"
Question 4hardmultiple choice
Review the full subnetting walkthrough →

Refer to the exhibit. A Lambda function uses the IAM role with the above policy. The function is configured to access a DynamoDB table MyTable and an RDS instance in a VPC. When invoked, the function fails with an error indicating it cannot describe VPC subnets. What is the MOST likely cause?

Exhibit

Refer to the exhibit.

```
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowVPCAccess",
      "Effect": "Allow",
      "Action": [
        "ec2:CreateNetworkInterface",
        "ec2:DescribeNetworkInterfaces",
        "ec2:DeleteNetworkInterface"
      ],
      "Resource": "*"
    },
    {
      "Sid": "AllowWriteToTable",
      "Effect": "Allow",
      "Action": [
        "dynamodb:PutItem",
        "dynamodb:UpdateItem"
      ],
      "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/MyTable"
    }
  ]
}
```
Question 5hardmultiple choice
Full question →

Refer to the exhibit. A CloudFormation template deploys a Lambda function with X-Ray tracing enabled. However, traces are not appearing in the X-Ray console. What is the most likely missing configuration?

Exhibit

Refer to the exhibit.

```
Resources:
  MyLambdaFunction:
    Type: AWS::Lambda::Function
    Properties:
      Handler: index.handler
      Role: !GetAtt LambdaExecutionRole.Arn
      Code:
        ZipFile: |
          exports.handler = async (event) => {
            console.log(JSON.stringify(event));
            return { statusCode: 200 };
          };
      Runtime: nodejs18.x
      TracingConfig:
        Mode: Active
  LambdaExecutionRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: '2012-10-17'
        Statement:
          - Effect: Allow
            Principal:
              Service: lambda.amazonaws.com
            Action: sts:AssumeRole
      ManagedPolicyArns:
        - arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
```
Question 6mediummultiple choice
Full question →

Refer to the exhibit. A security engineer sees this CloudTrail event. What action did the user 'admin' perform?

Network Topology
# aws cloudtrail lookup-eventslookup-attributes AttributeKey=EventNameRefer to the exhibit."Events": ["EventId": "example-event-id","EventName": "CreateKey","EventTime": "2023-01-15T10:00:00Z","Username": "admin","Resources": ["ResourceName": "arn:aws:kms:us-east-1:123456789012:key/abc123","ResourceType": "AWS::KMS::Key"],"CloudTrailEvent": "{\"requestParameters\":{\"keyUsage\":\"ENCRYPT_DECRYPT\",\"keySpec\":\"SYMMETRIC_DEFAULT\"}}"
Question 7hardmultiple choice
Full question →

Refer to the exhibit. A developer is troubleshooting a failed AWS CodeBuild build. The buildspec file contains the following build commands: 'pre_build' - run linting, 'build' - './gradlew build', 'post_build' - package artifact. The error occurs in the build phase. Which of the following is the MOST likely cause?

Exhibit

Build complete
[Container] 2024/03/15 14:30:00 Phase complete: BUILD State: FAILED
[Container] 2024/03/15 14:30:00 Phase context: statusCode: COMMAND_EXECUTION_ERROR, Message: Error while executing command: ./gradlew build. Reason: exit status 1
Question 8hardmultiple choice
Full question →

Refer to the exhibit. A DevOps engineer is troubleshooting an issue where an IAM user is unable to stop an EC2 instance with the tag 'Environment: Development'. The attached IAM policy is shown. Which statement explains the failure?

Exhibit

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ec2:DescribeInstances",
        "ec2:StartInstances",
        "ec2:StopInstances"
      ],
      "Resource": "*"
    },
    {
      "Effect": "Deny",
      "Action": "ec2:TerminateInstances",
      "Resource": "arn:aws:ec2:us-east-1:123456789012:instance/*",
      "Condition": {
        "StringNotEquals": {
          "ec2:ResourceTag/Environment": "Production"
        }
      }
    }
  ]
}
Question 9mediummultiple choice
Full question →

Refer to the exhibit. A CloudFormation stack has been deployed. A developer wants to use the S3 bucket name in a subsequent AWS CLI command. Which command will correctly retrieve the bucket name?

Network Topology
$ aws cloudformation describe-stacksstack-name my-stackquery "Stacks[0].Outputs""OutputKey": "BucketName","OutputValue": "my-stack-bucket-123456","Description": "S3 Bucket Name"},"OutputKey": "InstanceId","OutputValue": "i-0abcd1234efgh5678","Description": "EC2 Instance ID"
Question 10hardmultiple choice
Full question →

Refer to the exhibit. A developer is using this buildspec.yml in AWS CodeBuild to build and push a Docker image to Amazon ECR. The build fails with the error: 'Error: No region specified'. Which change should the developer make to resolve this error?

Network Topology
- aws ecr get-login-passwordregion $AWS_DEFAULT_REGIONusername AWSpassword-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com## buildspec.ymlversion: 0.2phases:pre_build:commands:build:- docker tag my-app:latest $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/my-app:latestpost_build:- docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/my-app:latestartifacts:files: imagedefinitions.json
Question 11hardmultiple choice
Full question →

Refer to the exhibit. A DevOps engineer deploys this CloudFormation template. The EC2 instance launches, but the httpd service does not start. The engineer connects to the instance and finds that the user data script did not run. What is the most likely cause?

Exhibit

Refer to the exhibit.

Resources:
  MyEC2Instance:
    Type: AWS::EC2::Instance
    Properties:
      ImageId: ami-0abcdef1234567890
      InstanceType: t2.micro
      UserData:
        Fn::Base64: !Sub |
          #!/bin/bash
          yum install -y httpd
          systemctl start httpd
          systemctl enable httpd
      Tags:
        - Key: Name
          Value: MyInstance
Question 12hardmultiple choice
Full question →

Refer to the exhibit. The deployment succeeded but the application fails. What is the MOST likely cause?

Exhibit

CodePipeline execution history:
Pipeline: MyPipeline
Date: 2024-03-01
Stage: Deploy
Action: DeployToECS

Execution ID: e-123456789
Status: Succeeded

Revision: commit SHA abc123
Deployment details:
  - ECS service: my-service
  - Task definition: my-task:12
  - Desired count: 2
  - Running count: 2
  - Pending count: 0

After deployment, application health checks fail. Rolling back to previous revision (task definition my-task:11) resolves the issue.

CloudWatch Logs from ECS tasks:
[ERROR] Failed to connect to database: TimeoutError: connect ETIMEDOUT 10.0.0.5:5432
Question 13mediummultiple choice
Full question →

Refer to the exhibit. A DevOps engineer ran the above AWS CLI command after a CloudFormation stack update. What does the status 'ROLLBACK_COMPLETE' indicate?

Network Topology
$ aws cloudformation describe-stacksstack-name myapp-stackquery "Stacks[0].StackStatus"Refer to the exhibit."StackStatus": "ROLLBACK_COMPLETE"
Question 14hardmultiple choice
Full question →

Refer to the exhibit. An IAM policy is attached to an IAM role used by an EC2 instance to manage other EC2 instances. The operations team reports that the instance can start and stop other instances but cannot terminate them. However, they also notice that the instance cannot describe instances in any region other than us-east-1. What is the reason for this behavior?

Exhibit

Refer to the exhibit.

```
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ec2:DescribeInstances",
        "ec2:StartInstances",
        "ec2:StopInstances"
      ],
      "Resource": "*"
    },
    {
      "Effect": "Deny",
      "Action": "ec2:TerminateInstances",
      "Resource": "arn:aws:ec2:us-east-1:123456789012:instance/*"
    }
  ]
}
```
Question 15mediummultiple choice
Full question →

Refer to the exhibit. A DevOps engineer runs the above commands. The build project 'my-project' uses an S3 bucket as source and another S3 bucket for artifacts. The build fails with an 'Access Denied' error when trying to download the source code. What is the most likely cause?

Network Topology
$ aws codebuild batch-get-projectsnames my-projectRefer to the exhibit.$ aws codebuild list-projects"projects": ["my-project""name": "my-project","source": {"type": "S3","location": "my-bucket/my-key.zip"},"artifacts": {"location": "my-artifact-bucket/""environment": {"computeType": "BUILD_GENERAL1_SMALL","image": "aws/codebuild/standard:5.0","type": "LINUX_CONTAINER""serviceRole": "arn:aws:iam::123456789012:role/service-role/codebuild-service-role","encryptionKey": "arn:aws:kms:us-east-1:123456789012:alias/aws/s3"

These DOP-C02 practice questions are part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style DOP-C02 questions with detailed explanations, topic-based practice, mock exams, readiness tracking, and study analytics.