DOP-C02 SDLC Automation • Complete Question Bank
Complete DOP-C02 SDLC Automation question bank — all 0 questions with answers and detailed explanations.
Drag steps to the numbered slots on the right, or tap a step then tap a slot.
Drag a concept onto its matching description — or click a concept then click the description.
Two identical environments; traffic switches after validation
Incremental rollout to a small subset before full release
Updates instances in batches to minimize downtime
Replaces entire instances with new ones; no in-place changes
Deploys to all instances simultaneously (fastest but riskier)
Refer to the exhibit.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"codebuild:StartBuild",
"codebuild:BatchGetBuilds"
],
"Resource": "arn:aws:codebuild:us-east-1:123456789012:project/my-project"
},
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "*"
}
]
}Refer to the exhibit.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "codedeploy:*",
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"autoscaling:CompleteLifecycleAction",
"autoscaling:DescribeLifecycleHooks",
"autoscaling:RecordLifecycleActionHeartbeat"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "iam:PassRole",
"Resource": "arn:aws:iam::123456789012:role/CodeDeployServiceRole"
}
]
}Refer to the exhibit.
Resources:
MyLambdaFunction:
Type: AWS::Lambda::Function
Properties:
Code:
S3Bucket: my-bucket
S3Key: function.zip
Handler: index.handler
Role: !GetAtt LambdaExecutionRole.Arn
Runtime: python3.9
LambdaExecutionRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service: lambda.amazonaws.com
Action: sts:AssumeRole
Policies:
- PolicyName: LambdaPolicy
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action: logs:CreateLogGroup
Resource: arn:aws:logs:us-east-1:123456789012:*
- Effect: Allow
Action: logs:CreateLogStream
Resource: arn:aws:logs:us-east-1:123456789012:*
- Effect: Allow
Action: logs:PutLogEvents
Resource: arn:aws:logs:us-east-1:123456789012:*Refer to the exhibit.
```
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"codepipeline:StartPipelineExecution",
"codepipeline:GetPipeline"
],
"Resource": "arn:aws:codepipeline:us-east-1:123456789012:MyPipeline"
},
{
"Effect": "Allow",
"Action": [
"s3:GetObject"
],
"Resource": "arn:aws:s3:::my-artifact-bucket/*"
}
]
}
```Refer to the exhibit.
```
Resources:
MyLambdaFunction:
Type: AWS::Lambda::Function
Properties:
Code:
S3Bucket: my-lambda-bucket
S3Key: my-function.zip
Handler: index.handler
Role: !GetAtt LambdaExecutionRole.Arn
Runtime: python3.9
MyLambdaVersion:
Type: AWS::Lambda::Version
Properties:
FunctionName: !Ref MyLambdaFunction
MyAlias:
Type: AWS::Lambda::Alias
Properties:
FunctionName: !Ref MyLambdaFunction
FunctionVersion: !Ref MyLambdaVersion
Name: prod
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
```Refer to the exhibit.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "codecommit:GitPull",
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "codecommit:GitPush",
"Resource": "arn:aws:codecommit:us-east-1:123456789012:MyRepo"
}
]
}Refer to the exhibit.
# Buildspec.yml
version: 0.2
phases:
install:
runtime-versions:
nodejs: 12
commands:
- npm install
build:
commands:
- npm run build
artifacts:
files:
- '**/*'Refer to the exhibit.
# IAM Policy for CodePipeline Service Role
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"codedeploy:CreateDeployment",
"codedeploy:GetDeployment",
"codedeploy:GetDeploymentGroup"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"ecs:DescribeServices"
],
"Resource": "arn:aws:ecs:us-east-1:123456789012:service/my-service"
}
]
}Refer to the exhibit.
# AWS CLI output from 'aws codepipeline list-pipelines'
{
"pipelines": [
{
"name": "my-app-pipeline",
"version": 5,
"created": 1620000000.0,
"pipelineType": "V1",
"executionMode": "QUEUED"
}
]
}Refer to the exhibit.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::my-bucket/*"
},
{
"Effect": "Allow",
"Action": [
"codedeploy:CreateDeployment",
"codedeploy:GetDeployment"
],
"Resource": "*"
}
]
}Refer to the exhibit.
{
"source": [
{
"provider": "S3",
"bucket": "my-source-bucket",
"object_key": "source.zip",
"region": "us-east-1"
}
],
"stages": [
{
"name": "Build",
"actions": [
{
"name": "Build",
"provider": "CodeBuild",
"project": "my-project",
"region": "us-east-1"
}
]
},
{
"name": "Deploy",
"actions": [
{
"name": "Deploy",
"provider": "CodeDeploy",
"application": "my-app",
"deployment_group": "my-group",
"region": "us-west-2"
}
]
}
]
}Refer to the exhibit.
```
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"codecommit:GitPull",
"codecommit:GitPush"
],
"Resource": "arn:aws:codecommit:us-east-1:123456789012:MyRepo",
"Condition": {
"StringEquals": {
"codecommit:References": ["refs/heads/main"]
}
}
}
]
}
```Refer to the exhibit. ``` Starting build... [Container] 2024/01/15 10:00:00 Phase complete: DOWNLOAD_SOURCE State: FAILED [Container] 2024/01/15 10:00:00 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: git fetch origin +refs/pull/*:refs/remotes/origin/pr/*. Reason: exit status 128 ```
Refer to the exhibit.
```
{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"Environment": {
"Type": "String",
"AllowedValues": ["dev", "prod"]
}
},
"Conditions": {
"IsProd": {"Fn::Equals": [{"Ref": "Environment"}, "prod"]}
},
"Resources": {
"MyBucket": {
"Type": "AWS::S3::Bucket",
"DeletionPolicy": {"Fn::If": ["IsProd", "Retain", "Delete"]}
}
}
}
```{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "codepipeline:StartPipelineExecution",
"Resource": "arn:aws:codepipeline:us-east-1:123456789012:MyPipeline"
},
{
"Effect": "Deny",
"Action": "codepipeline:*",
"Resource": "*",
"Condition": {
"StringNotEquals": {
"aws:SourceAccount": "123456789012"
}
}
}
]
}arn:aws:cloudformation:us-west-2:123456789012:stack/MyStack/abc123
buildspec.yml:
version: 0.2
phases:
install:
runtime-versions:
python: 3.8
commands:
- pip install -r requirements.txt
build:
commands:
- python setup.py build
artifacts:
files:
- '**/*'
base-directory: 'dist'{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"codepipeline:StartPipelineExecution",
"codepipeline:PutJobSuccessResult",
"codepipeline:PutJobFailureResult"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"codebuild:StartBuild",
"codebuild:BatchGetBuilds"
],
"Resource": "arn:aws:codebuild:us-east-1:123456789012:project/my-project"
},
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::my-artifact-bucket/*"
}
]
}arn:aws:lambda:us-east-1:123456789012:function:my-function
Refer to the exhibit.
```
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"codebuild:StartBuild",
"codebuild:BatchGetBuilds"
],
"Resource": "arn:aws:codebuild:us-east-1:123456789012:project/my-project"
},
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::my-artifact-bucket/*"
}
]
}
```Refer to the exhibit.
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "lambda:InvokeFunction",
"Resource": "arn:aws:lambda:us-east-1:123456789012:function:my-function"
},
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::my-bucket/*"
}
]
}
```Refer to the exhibit.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"codebuild:StartBuild",
"codebuild:BatchGetBuilds"
],
"Resource": "arn:aws:codebuild:us-east-1:123456789012:project/MyProject"
}
]
}Refer to the exhibit.
version: 0.2
phases:
install:
runtime-versions:
python: 3.8
pre_build:
commands:
- pip install flake8
- flake8 src/
build:
commands:
- python setup.py build
post_build:
commands:
- python -m unittest discover
artifacts:
files:
- '**/*'
discard-paths: yesRefer to the exhibit.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::my-bucket/*",
"Condition": {
"StringEquals": {
"s3:x-amz-acl": "bucket-owner-full-control"
}
}
}
]
}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: MyInstanceRefer to the exhibit.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"codebuild:StartBuild",
"codebuild:BatchGetBuilds"
],
"Resource": "arn:aws:codebuild:us-east-1:123456789012:project/my-project"
},
{
"Effect": "Allow",
"Action": [
"codepipeline:StartPipelineExecution",
"codepipeline:GetPipelineState"
],
"Resource": "arn:aws:codepipeline:us-east-1:123456789012:my-pipeline"
}
]
}Refer to the exhibit.
version: 0.2
phases:
install:
runtime-versions:
nodejs: 12
commands:
- npm install
build:
commands:
- npm run build
artifacts:
files:
- '**/*'
discard-paths: yesRefer to the exhibit.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"codepipeline:StartPipelineExecution",
"codepipeline:GetPipeline"
],
"Resource": "arn:aws:codepipeline:us-east-1:123456789012:MyPipeline"
},
{
"Effect": "Allow",
"Action": [
"codecommit:GitPush"
],
"Resource": "arn:aws:codecommit:us-east-1:123456789012:MyRepo"
}
]
}Refer to the exhibit.
buildspec.yaml:
version: 0.2
phases:
install:
runtime-versions:
nodejs: 14
commands:
- npm install
build:
commands:
- npm run build
artifacts:
files:
- '**/*'
base-directory: build
discard-paths: no{
"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. A CloudTrail log shows a failed GitPush event to a CodeCommit repository by the IAM user 'jenkins'. The DevOps engineer has attached the following IAM policy to the user:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "codecommit:*",
"Resource": "*"
}
]
}What is the MOST likely reason for the failure?
{
"eventVersion": "1.05",
"userIdentity": {
"type": "IAMUser",
"arn": "arn:aws:iam::123456789012:user/jenkins"
},
"eventTime": "2023-01-15T10:00:00Z",
"eventSource": "codecommit.amazonaws.com",
"eventName": "GitPush",
"awsRegion": "us-east-1",
"sourceIPAddress": "203.0.113.5",
"userAgent": "git/2.30.0",
"requestParameters": {
"repositoryName": "my-repo",
"branchName": "main"
},
"responseElements": null,
"errorCode": "AccessDeniedException",
"errorMessage": "User: arn:aws:iam::123456789012:user/jenkins is not authorized to perform: codecommit:GitPush on resource: arn:aws:codecommit:us-east-1:123456789012:my-repo"
}{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"codepipeline:StartPipelineExecution",
"codepipeline:GetPipeline"
],
"Resource": "arn:aws:codepipeline:us-east-1:123456789012:MyPipeline"
}
]
}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
CodePipeline execution details: - Source: CodeCommit (branch: main) - Build: CodeBuild (buildspec.yml) - Deploy: CloudFormation (template.yml) - Status: Failed at Deploy stage - Error message: "The following resource(s) failed to create: [MyLambdaFunction]. WaitCondition received 1 unique messages. UniqueId count: 1. Received: 'CREATE_FAILED'" - CloudFormation stack events: "Resource creation cancelled" for a Lambda function with a VPC configuration. - Build logs show: "npm install succeeded, tests passed"
CloudFormation template snippet:
Resources:
MyAutoScalingGroup:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
LaunchConfigurationName: !Ref MyLaunchConfig
MinSize: '2'
MaxSize: '10'
DesiredCapacity: '4'
AvailabilityZones:
- us-east-1a
- us-east-1b
MyLaunchConfig:
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
ImageId: ami-12345678
InstanceType: t2.micro
UserData:
Fn::Base64: !Sub |
#!/bin/bash
systemctl start myapp
MyScalingPolicy:
Type: AWS::AutoScaling::ScalingPolicy
Properties:
AutoScalingGroupName: !Ref MyAutoScalingGroup
PolicyType: TargetTrackingScaling
TargetTrackingConfiguration:
PredefinedMetricSpecification:
PredefinedMetricType: ASGAverageCPUUtilization
TargetValue: 50.0
CloudWatch alarm: CPUUtilization > 60% for 5 minutes triggers scale-up. After 1 hour, the ASG has 8 instances but CPU stays around 70%.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