A DevOps engineer needs to back up sensitive Amazon S3 objects that are stored within
an S3 bucket with a private bucket policy using S3 cross-Region replication functionality.
The objects need to be copied to a target bucket in a different AWS Region and account.
Which combination of actions should be performed to enable this replication? (Choose
three.)
Show answerHide answer
Correct answer: A, D, ECreate a replication IAM role in the source accountAdd statements to the target bucket policy allowing the replication IAM role to replicate
objects.Create a replication rule in the source bucket to enable the replication.
Explanation
Explanation: S3 cross-Region replication (CRR) automatically replicates data between
buckets across different AWS Regions. To enable CRR, you need to add a replication
configuration to your source bucket that specifies the destination bucket, the IAM role, and
the encryption type (optional). You also need to grant permissions to the IAM role to
perform replication actions on both the source and destination buckets. Additionally, you
can choose the destination storage class and enable additional replication options such as
S3 Replication Time Control (S3 RTC) or S3 Batch Replication.
Question 62Choose 2
A company wants to deploy a workload on several hundred Amazon EC2 instances. The
company will provision the EC2 instances in an Auto Scaling group by using a launch template.
The workload will pull files from an Amazon S3 bucket, process the data, and put the
results into a different S3 bucket. The EC2 instances must haveleast-privilege permissions
and must use temporary security credentials.
Which combination of steps will meet these requirements? (Select TWO.)
Show answerHide answer
Correct answer: A, BCreate an IAM role that has the appropriate permissions for S3 buckets. Add the IAM
role to an instance profile.Update the launch template to include the IAM instance profile.
Explanation
Explanation:
To meet the requirements of deploying a workload on several hundred EC2 instances with
least-privilege permissions and temporary security credentials, the company should use an
IAM role and an instance profile. An IAM role is a way to grant permissions to an entity that
you trust, such as an EC2 instance. An instance profile is a container for an IAM role that
you can use to pass role information to an EC2 instance when the instance starts. By using
an IAM role and an instance profile, the EC2 instances can automatically receive temporary
security credentials from the AWS Security Token Service (STS) and use them to access
the S3 buckets. This way, the company does not need to manage or rotate any long-term
credentials, such as IAM users or access keys.
To use an IAM role and an instance profile, the company should create an IAM role that
has the appropriate permissions for S3 buckets. The permissions should allow the EC2
instances to read from the source S3 bucket and write to the destination S3 bucket. The
company should also create a trust policy for the IAM role that specifies that EC2 is allowed
to assume the role. Then, the company should add the IAM role to an instance profile. An
instance profile can have only one IAM role, so the company does not need to create
multiple roles or profiles for this scenario.
Next, the company should update the launch template to include the IAM instance profile. A
launch template is a way to save launch parameters for EC2 instances, such as the
instance type, security group, user data, and IAM instance profile. By using a launch
template, the company can ensure that all EC2 instances in the Auto Scaling group have consistent configuration and permissions. The company should specify the name or ARN of
the IAM instance profile in the launch template. This way, when theAuto Scaling group
launches new EC2 instances based on the launch template, they will automatically receive
the IAM role and its permissions through the instance profile.
The other options are not correct because they do not meet the requirements or follow best
practices. Creating an IAM user and generating a secret key and token is not a good option
because it involves managing long-term credentials that need to be rotated regularly.
Moreover, embedding credentials in user data is not secure because user data is visible to
anyone who can describe the EC2 instance. Creating a trust anchor and profile is not a
valid option because trust anchors are used for certificate-based authentication, not for IAM
roles or instance profiles. Modifying user data to use a new secret key and token is also not
a good option because it requires updating user data every time the credentials change,
which is not scalable or efficient.
Question 63Choose 1
A company is using AWS CodePipeline to automate its release pipeline. AWS CodeDeploy
is being used in the pipeline to deploy an application to Amazon Elastic Container Service
(Amazon ECS) using the blue/green deployment model. The company wants to implement
scripts to test the green version of the application before shifting traffic. These scripts will
complete in 5 minutes or less. If errors are discovered during these tests, the application
must be rolled back.
Which strategy will meet these requirements?
Show answerHide answer
Correct answer: CAdd a hooks section to the CodeDeploy AppSpec file. Use the AfterAllowTestTraffic
lifecycle event to invoke an AWS Lambda function to run the test scripts. If errors are
found, exit the Lambda function with an error to initiate rollback.
Question 64Choose 2
A DevOps engineer is deploying a new version of a company's application in an AWS
CodeDeploy deployment group associated with its Amazon EC2 instances. After some
time, the deployment fails. The engineer realizes that all the events associated with the
specific deployment ID are in a Skipped status and code was not deployed in the instances
associated with the deployment group.
What are valid reasons for this failure? (Select TWO.).
Show answerHide answer
Correct answer: A, DThe networking configuration does not allow the EC2 instances to reach the internet via
a NAT gateway or internet gateway and the CodeDeploy endpoint cannot be reached.An instance profile with proper permissions was not attached to the target EC2
instances.
Question 65Choose 1
A company has an on-premises application that is written in Go. A DevOps engineer must
move the application to AWS. The company's development team wants to enable blue/green deployments and perform A/B testing.
Which solution will meet these requirements?
Show answerHide answer
Correct answer: DUse AWS Elastic Beanstalk to host the application. Store a zipped version of the
application in Amazon S3. Use that location to deploy new versions of the application. Use
Elastic Beanstalk to manage the deployment options.
Question 66Choose 1
A company has deployed a critical application in two AWS Regions. The application uses
an Application Load Balancer (ALB) in both Regions. The company has Amazon Route 53
alias DNS records for both ALBs.
The company uses Amazon Route 53 Application Recovery Controller to ensure that the
application can fail over between the two Regions. The Route 53 ARC configuration
includes a routing control for both Regions. The company uses Route 53 ARC to perform
quarterly disaster recovery (DR) tests.
During the most recent DR test, a DevOps engineer accidentally turned off both routing
controls. The company needs to ensure that at least one routing control is turned on at all
times.
Which solution will meet these requirements?
Show answerHide answer
Correct answer: AIn Route 53 ARC. create a new assertion safety rule. Apply the assertion safety rule to
the two routing controls. Configure the rule with the ATLEAST type with a threshold of 1.
Explanation
Explanation:
The correct solution is to create a new assertion safety rule in Route 53 ARC and apply it
to the two routing controls. An assertion safety rule is a type of safety rule that ensures that
a minimum number of routing controls are always enabled. The ATLEAST type of assertion
safety rule specifies the minimum number of routing controls that must be enabled for the
rule to evaluate as healthy. By setting the threshold to 1, the rule ensures that at least one
routing control is always turned on. This prevents the scenario where both routing controls
are accidentally turned off and the application becomes unavailable in both Regions.
The other solutions are incorrect because they do not use safety rules to prevent both
routing controls from being turned off. A gating safety rule is a type of safety rule that
prevents routing control state changes that violate the rule logic. The OR type of gating
safety rule specifies that one or more routing controls must be enabled for the rule to
evaluate as healthy. However, this rule does not prevent a user from turning off both
routing controls manually. A resource set is a collection of resources that are tested for
readiness by Route 53 ARC. A readiness check is a test that verifies that all the resources
in a resource set are operational. However, these concepts are not related to routing
control states or safety rules. Therefore, creating a new resource set and a new readiness
check will not ensure that at least one routing control is turned on at all times.
Question 67Choose 1
A developer is maintaining a fleet of 50 Amazon EC2 Linux servers. The servers are part of
an Amazon EC2 Auto Scaling group, and also use Elastic Load Balancing for load
balancing.
Occasionally, some application servers are being terminated after failing ELB HTTP health
checks. The developer would like to perform a root cause analysis on the issue, but before
being able to access application logs, the server is terminated.
How can log collection be automated?
Show answerHide answer
Correct answer: DUse Auto Scaling lifecycle hooks to put instances in a Terminating:Wait state. Create an
Amazon EventBridge rule for EC2 Instance-terminate Lifecycle Action and trigger an AWS
Lambda function that invokes an SSM Run Command script to collect logs, push them to
Amazon S3, and complete the lifecycle action once logs are collected.
Question 68Choose 1
A DevOps engineer manages a company's Amazon Elastic Container Service (Amazon
ECS) cluster. The cluster runs on several Amazon EC2 instances that are in an Auto
Scaling group. The DevOps
engineer must implement a solution that logs and reviews all stopped tasks for errors.
Which solution will meet these requirements?
Show answerHide answer
Correct answer: ACreate an Amazon EventBridge rule to capture task state changes. Send the event to
Amazon CloudWatch Logs. Use CloudWatch Logs Insights to investigate stopped tasks.
Explanation
Explanation:
The best solution to log and review all stopped tasks for errors is to use Amazon
EventBridge and Amazon CloudWatch Logs. Amazon EventBridge allows the DevOps
engineer to create a rule that matches task state change events from Amazon ECS. The
rule can then send the event data to Amazon CloudWatch Logs as the target. Amazon
CloudWatch Logs can store and monitor the log data, and also provide CloudWatch Logs
Insights, a feature that enables the DevOps engineer to interactively search and analyze
the log data. Using CloudWatch Logs Insights, the DevOps engineer can filter and
aggregate the log data based on various fields, such as cluster, task, container, and
reason. This way, the DevOps engineer can easily identify and investigate the stopped
tasks and their errors.
The other options are not as effective or efficient as the solution in option A. Option B is not
suitable because the embedded metric format is designed for custom metrics, not for
logging task state changes. Option C is not feasible because the EC2 instances do not
store the task state change events in their logs. Option D is not relevant because
theEC2_INSTANCE_TERMINATING lifecycle hook is triggered when an EC2 instance is
terminated by the Auto Scaling group, not when a task is stopped by Amazon ECS.
Question 69Choose 1
A company uses AWS Organizations to manage multiple accounts. Information security
policies require that all unencrypted Amazon EBS volumes be marked as non-compliant. A
DevOps engineer needs to automatically deploy the solution and ensure that this
compliance check is always present.
Which solution will accomplish this?
Show answerHide answer
Correct answer: BCreate an AWS Config organizational rule to check whether EBS encryption is enabled
and deploy the rule using the AWS CLI. Create and apply an SCP to prohibit stopping and
deleting AWS Config across the organization.
Question 70Choose 1
A company manages AWS accounts for application teams in AWS Control Tower.
Individual application teams are responsible for securing their respective AWS accounts.
A DevOps engineer needs to enable Amazon GuardDuty for all AWS accounts in which the
application teams have not already enabled GuardDuty. The DevOps engineer is using
AWS CloudFormation StackSets from the AWS Control Tower management account.
How should the DevOps engineer configure the CloudFormation template to prevent failure
during the StackSets deployment?
Show answerHide answer
Correct answer: ACreate a CloudFormation custom resource that invokes an AWS Lambda function.
Configure the Lambda function to conditionally enable GuardDuty if GuardDuty is not
already enabled in the accounts.
Explanation
Explanation: This solution will meet the requirements because it will use a CloudFormation custom resource to execute custom logic during the stack set operation. A
custom resource is a resource that you define in your template and that is associated with
an AWS Lambda function. The Lambda function runs whenever the custom resource is
created, updated, or deleted, and can perform any actions that are supported by the AWS
SDK. In this case, the Lambda function can use the GuardDuty API to check whether
GuardDuty is already enabled in each target account, and if not, enable it. This way, the
DevOps engineer can avoid deploying the stack set to accounts that already have
GuardDuty enabled, and prevent failure during the deployment.
Full mock exam
Sit the DOP-C02 exam before exam day
Full-length mocks with the same number of questions and the same time limit as the real DOP-C02 exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.