AWS Certified DevOps Engineer - Professional (DOP-C02) — Free Practice Questions
10 free sample questions from a bank of 529, with the correct answers and explanations. No signup required — start practising right now.
1A company has a mobile application that makes HTTP API calls to an Application Load Balancer (ALB). The ALB routes requests to an AWS Lambda function. Many different versions of the application are in use at any given time, including versions that are in testing by a subset of users. The version of the application is defined in the user-agent header that is sent with all requests to the API.
After a series of recent changes to the API, the company has observed issues with the application. The company needs to gather a metric for each API operation by response code for each version of the application that is in use. A DevOps engineer has modified the Lambda function to extract the API operation name, version information from the user-agent header and response code.
Which additional set of actions should the DevOps engineer take to gather the required metrics?
Modify the Lambda function to write the API operation name, response code, and version number as a log line to an Amazon CloudWatch Logs log group. Configure a CloudWatch Logs metric filter that increments a metric for each API operation name. Specify response code and application version as dimensions for the metric.
Modify the Lambda function to write the API operation name, response code, and version number as a log line to an Amazon CloudWatch Logs log group. Configure a CloudWatch Logs Insights query to populate CloudWatch metrics from the log lines. Specify response code and application version as dimensions for the metric.
Configure the ALB access logs to write to an Amazon CloudWatch Logs log group. Modify the Lambda function to respond to the ALB with the API operation name, response code, and version number as response metadata. Configure a CloudWatch Logs metric filter that increments a metric for each API operation name. Specify response code and application version as dimensions for the metric.
Configure AWS X-Ray integration on the Lambda function. Modify the Lambda function to create an X-Ray subsegment with the API operation name, response code, and version number. Configure X-Ray insights to extract an aggregated metric for each API operation name and to publish the metric to Amazon CloudWatch. Specify response code and application version as dimensions for the metric.
Answer: A
The short version
A — Log structured lines plus metric filters with dimensions. Lambda writes operation, code, and version to CloudWatch Logs, then filters turn them into queryable metrics.
Key concepts in this question
Metric filters: parse log events into CloudWatch metrics with up to three dimensions for slicing
Version in user-agent: per-release visibility requires version as a dimension alongside operation and response code
Insights versus filters: Insights queries analyze logs ad hoc but do not persist as standard metrics automatically
ALB logs and X-Ray: capture edge or trace data, not the Lambda-extracted operation and version mapping
Why A is correct
The Lambda already extracts operation, version, and code, so persisting that triple as a log line lets a metric filter increment per operation with code and version dimensions. That yields durable per-version per-code metrics for dashboards and alarms. Alternatives relying on Insights queries or ALB metadata miss the persistent dimensional metric requirement.
Why the others are wrong
B. runs interactive log queries instead of creating persistent dimensional metrics
C. depends on ALB log fields that lack the Lambda-derived operation mapping
D. traces requests in X-Ray without producing the required CloudWatch metric dimensions
DOP-C02 exam tip
Need per-operation per-version counts equals metric filter with dimensions: log the triple, filter it, slice by code and version.
2A company provides an application to customers. The application has an Amazon API Gateway REST API that invokes an AWS Lambda function. On initialization, the Lambda function loads a large amount of data from an Amazon DynamoDB table. The data load process results in long cold-start times of 8-10 seconds. The DynamoDB table has DynamoDB Accelerator (DAX) configured.
Customers report that the application intermittently takes a long time to respond to requests. The application receives thousands of requests throughout the day. In the middle of the day, the application experiences 10 times more requests than at any other time of the day. Near the end of the day, the application's request volume decreases to 10% of its normal total.
A DevOps engineer needs to reduce the latency of the Lambda function at all times of the day.
Which solution will meet these requirements?
Configure provisioned concurrency on the Lambda function with a concurrency value of 1. Delete the DAX cluster for the DynamoDB table.
Configure reserved concurrency on the Lambda function with a concurrency value of 0.
Configure provisioned concurrency on the Lambda function. Configure AWS Application Auto Scaling on the Lambda function with provisioned concurrency values set to a minimum of 1 and a maximum of 100.
Configure reserved concurrency on the Lambda function. Configure AWS Application Auto Scaling on the API Gateway API with a reserved concurrency maximum value of 100.
Answer: C
The short version
C — Provisioned concurrency with auto scaling handles spiky cold starts. Pre-warmed execution plus scaling from 1 to 100 keeps latency low all day.
Key concepts in this question
Cold starts: 8 to 10 second DynamoDB load on init penalizes infrequent containers
Provisioned concurrency: keeps functions initialized and ready, eliminating init delay
Auto scaling for concurrency: adjusts pre-warmed count with demand, covering midday 10x peaks and evening lows
Reserved concurrency: caps parallelism but does not keep functions warm
Why C is correct
Intermittent slowness amid variable traffic points to cold containers during scale-out, worsened by heavy init plus DAX. Provisioned concurrency removes init from request path while Application Auto Scaling tracks the daily curve without overpaying overnight. Deleting DAX or setting concurrency to zero would worsen data or throttle the app.
Why the others are wrong
A. leaves only one warm container and removes DAX acceleration, starving peaks
B. sets reserved concurrency to zero, effectively disabling the function
D. reserves but does not warm, and scales the wrong resource with API Gateway settings
DOP-C02 exam tip
Spiky Lambda plus heavy init equals provisioned plus auto scaling: warm the init, scale the warmth with traffic.
3A company is adopting AWS CodeDeploy to automate its application deployments for a Java-Apache Tomcat application with an Apache Webserver. The development team started with a proof of concept, created a deployment group for a developer environment, and performed functional tests within the application. After completion, the team will create additional deployment groups for staging and production.
The current log level is configured within the Apache settings, but the team wants to change this configuration dynamically when the deployment occurs, so that they can set different log level configurations depending on the deployment group without having a different application revision for each group.
How can these requirements be met with the LEAST management overhead and without requiring different script versions for each deployment group?
Tag the Amazon EC2 instances depending on the deployment group. Then place a script into the application revision that calls the metadata service and the EC2 API to identify which deployment group the instance is part of. Use this information to configure the log level settings. Reference the script as part of the AfterInstall lifecycle hook in the appspec.yml file.
Create a script that uses the CodeDeploy environment variable DEPLOYMENT_GROUP_ NAME to identify which deployment group the instance is part of. Use this information to configure the log level settings. Reference this script as part of the BeforeInstall lifecycle hook in the appspec.yml file.
Create a CodeDeploy custom environment variable for each environment. Then place a script into the application revision that checks this environment variable to identify which deployment group the instance is part of. Use this information to configure the log level settings. Reference this script as part of the ValidateService lifecycle hook in the appspec.yml file.
Create a script that uses the CodeDeploy environment variable DEPLOYMENT_GROUP_ID to identify which deployment group the instance is part of to configure the log level settings. Reference this script as part of the Install lifecycle hook in the appspec.yml file.
Answer: B
The short version
B — Use DEPLOYMENT_GROUP_NAME in BeforeInstall. One script reads the built-in variable to set log levels per group without extra revisions.
Key concepts in this question
CodeDeploy env variables: expose deployment group name to lifecycle scripts at runtime
BeforeInstall hook: runs before code copy, ideal for preparing config like log levels
Single revision goal: same bundle behaves differently per environment via runtime context
Metadata and custom vars: add API calls or manual setup, increasing overhead versus native variables
Why B is correct
The native group-name variable lets the same revision branch logic for dev, staging, and production with least management. BeforeInstall ensures logging config is ready before the new code installs. Other paths need instance tagging, custom variables, or later hooks that add complexity or timing issues.
Why the others are wrong
A. queries EC2 APIs per instance, adding latency and IAM complexity
C. requires maintaining custom variables per environment plus a late ValidateService hook
D. uses group ID which is opaque and hooks at Install after config should be ready
DOP-C02 exam tip
Same artifact different config per group equals built-in group-name variable in BeforeInstall, no extra revisions.
4A company requires its developers to tag all Amazon Elastic Block Store (Amazon EBS) volumes in an account to indicate a desired backup frequency. This requirement Includes EBS volumes that do not require backups. The company uses custom tags named Backup_Frequency that have values of none, dally, or weekly that correspond to the desired backup frequency. An audit finds that developers are occasionally not tagging the EBS volumes.
A DevOps engineer needs to ensure that all EBS volumes always have the Backup_Frequency tag so that the company can perform backups at least weekly unless a different value is specified.
Which solution will meet these requirements?
Set up AWS Config in the account. Create a custom rule that returns a compliance failure for all Amazon EC2 resources that do not have a Backup Frequency tag applied. Configure a remediation action that uses a custom AWS Systems Manager Automation runbook to apply the Backup_Frequency tag with a value of weekly.
Set up AWS Config in the account. Use a managed rule that returns a compliance failure for EC2::Volume resources that do not have a Backup Frequency tag applied. Configure a remediation action that uses a custom AWS Systems Manager Automation runbook to apply the Backup_Frequency tag with a value of weekly.
Turn on AWS CloudTrail in the account. Create an Amazon EventBridge rule that reacts to EBS CreateVolume events. Configure a custom AWS Systems Manager Automation runbook to apply the Backup_Frequency tag with a value of weekly. Specify the runbook as the target of the rule.
Turn on AWS CloudTrail in the account. Create an Amazon EventBridge rule that reacts to EBS CreateVolume events or EBS ModifyVolume events. Configure a custom AWS Systems Manager Automation runbook to apply the Backup_Frequency tag with a value of weekly. Specify the runbook as the target of the rule.
Answer: B
The short version
B — Managed Config rule plus remediation enforces tagging. The EC2 volume rule flags missing Backup_Frequency and auto-applies weekly by default.
Key concepts in this question
Required tags: Backup_Frequency with none, daily, or weekly drives backup selection
Managed rule: AWS Config provides volume-specific compliance without custom code
Remediation with SSM Automation: applies weekly when absent, still honoring explicit other values
Event-only paths: react to creation but miss existing untagged volumes and compliance reporting
Why B is correct
Audit found occasional missing tags across existing and new volumes, needing both detection and fix plus compliance view. A managed EC2 volume rule scopes precisely while remediation sets weekly as the safe default. Custom rules for all EC2 resources overreach and EventBridge alone lacks continuous compliance.
Why the others are wrong
A. uses a custom rule over all EC2 resources, broader and heavier than the managed volume rule
C. only tags on creation, ignoring already untagged volumes and compliance history
D. adds modify events yet still lacks Config compliance and may overwrite explicit values
DOP-C02 exam tip
Always-has-tag plus default weekly equals Config managed volume rule with SSM remediation, not just CreateVolume events.
5A company is using an Amazon Aurora cluster as the data store for its application. The Aurora cluster is configured with a single DB instance. The application performs read and write operations on the database by using the cluster's instance endpoint.
The company has scheduled an update to be applied to the cluster during an upcoming maintenance window. The cluster must remain available with the least possible interruption during the maintenance window.
What should a DevOps engineer do to meet these requirements?
Add a reader instance to the Aurora cluster. Update the application to use the Aurora cluster endpoint for write operations. Update the Aurora cluster's reader endpoint for reads.
Add a reader instance to the Aurora cluster. Create a custom ANY endpoint for the cluster. Update the application to use the Aurora cluster's custom ANY endpoint for read and write operations.
Turn on the Multi-AZ option on the Aurora cluster. Update the application to use the Aurora cluster endpoint for write operations. Update the Aurora cluster’s reader endpoint for reads.
Turn on the Multi-AZ option on the Aurora cluster. Create a custom ANY endpoint for the cluster. Update the application to use the Aurora cluster's custom ANY endpoint for read and write operations
Answer: A
The short version
A — Add a reader and split endpoints for maintenance. Cluster endpoint for writes plus reader endpoint for reads keeps service up during patching.
Key concepts in this question
Aurora endpoints: cluster endpoint tracks the writer, reader endpoint load-balances readers with failover
Reader addition: provides a failover target so writer maintenance promotes quickly with less outage
Instance endpoint: pins to one host and breaks on failover, unsuitable for continuity
Multi-AZ option: applies to RDS, not Aurora which already replicates storage across zones
Why A is correct
With a single instance using its direct endpoint, any update causes interruption and app rewiring. Adding a reader and moving writes to the cluster endpoint plus reads to the reader endpoint enables fast failover during maintenance. Aurora handles replication natively, so reader-based high availability is the least-interruption path.
Why the others are wrong
B. uses a custom ANY endpoint that complicates routing without the standard writer and reader split
C. invokes an RDS Multi-AZ concept that does not apply to Aurora architecture
D. combines the wrong Multi-AZ model with nonstandard endpoint use
DOP-C02 exam tip
Aurora single instance plus maintenance window equals add reader, use cluster for writes and reader for reads.
6A company must encrypt all AMIs that the company shares across accounts. A DevOps engineer has access to a source account where an unencrypted custom AMI has been built. The DevOps engineer also has access to a target account where an Amazon EC2 Auto Scaling group will launch EC2 instances from the AMI. The DevOps engineer must share the AMI with the target account.
The company has created an AWS Key Management Service (AWS KMS) key in the source account.
Which additional steps should the DevOps engineer perform to meet the requirements? (Choose three.)
In the source account, copy the unencrypted AMI to an encrypted AMI. Specify the KMS key in the copy action.
In the source account, copy the unencrypted AMI to an encrypted AMI. Specify the default Amazon Elastic Block Store (Amazon EBS) encryption key in the copy action.
In the source account, create a KMS grant that delegates permissions to the Auto Scaling group service-linked role in the target account.
In the source account, modify the key policy to give the target account permissions to create a grant. In the target account, create a KMS grant that delegates permissions to the Auto Scaling group service-linked role.
In the source account, share the unencrypted AMI with the target account.
In the source account, share the encrypted AMI with the target account.
Answer: A, D, F
The short version
ADF — Copy with KMS key, fix key policy with grant, share encrypted AMI. Those three steps deliver encrypted cross-account launch for Auto Scaling.
Key concepts in this question
Encrypted copy: creates a KMS-encrypted AMI from the unencrypted source using the source-account key
Cross-account KMS access: requires key-policy permission to create grants plus a grant to the target Auto Scaling role
Sharing the encrypted AMI: makes the encrypted snapshot usable in the target account
Default EBS key or unencrypted share: fails the encrypt-all-shared-AMIs mandate
Why ADF is correct
Encryption must happen in the source with the designated KMS key, then the target needs delegated grant rights to use it for launches. Sharing only the encrypted result preserves the encryption requirement end to end. Skipping the key-policy plus grant chain or sharing unencrypted breaks launch or compliance.
Why the others are wrong
B. uses the default EBS key instead of the required company KMS key
C. grants directly to the foreign role without the key-policy delegation model
E. shares unencrypted, violating the must-encrypt rule outright
DOP-C02 exam tip
Share encrypted AMIs cross-account with KMS: copy encrypted, allow grant via policy, create grant, then share encrypted.
7A company uses AWS CodePipeline pipelines to automate releases of its application A typical pipeline consists of three stages build, test, and deployment. The company has been using a separate AWS CodeBuild project to run scripts for each stage. However, the company now wants to use AWS CodeDeploy to handle the deployment stage of the pipelines.
The company has packaged the application as an RPM package and must deploy the application to a fleet of Amazon EC2 instances. The EC2 instances are in an EC2 Auto Scaling group and are launched from a common AMI.
Which combination of steps should a DevOps engineer perform to meet these requirements? (Choose two.)
Create a new version of the common AMI with the CodeDeploy agent installed. Update the IAM role of the EC2 instances to allow access to CodeDeploy.
Create a new version of the common AMI with the CodeDeploy agent installed. Create an AppSpec file that contains application deployment scripts and grants access to CodeDeploy.
Create an application in CodeDeploy. Configure an in-place deployment type. Specify the Auto Scaling group as the deployment target. Add a step to the CodePipeline pipeline to use EC2 Image Builder to create a new AMI. Configure CodeDeploy to deploy the newly created AMI.
Create an application in CodeDeploy. Configure an in-place deployment type. Specify the Auto Scaling group as the deployment target. Update the CodePipeline pipeline to use the CodeDeploy action to deploy the application.
Create an application in CodeDeploy. Configure an in-place deployment type. Specify the EC2 instances that are launched from the common AMI as the deployment target. Update the CodePipeline pipeline to use the CodeDeploy action to deploy the application.
Answer: A, D
The short version
AD — Bake the agent with IAM access and deploy in place to the ASG. Agent-ready AMI plus CodeDeploy in-place to the Auto Scaling group integrates cleanly with Pipeline.
Key concepts in this question
CodeDeploy agent: must be present on EC2 to execute AppSpec lifecycle for RPM installs
IAM role: grants instances rights to poll CodeDeploy and fetch artifacts
In-place to ASG: updates existing fleet without replacing the whole architecture
RPM to an Auto Scaling fleet needs hosts that can run deployments and a deployment definition targeting the group. Baking the agent with proper role permissions plus an in-place ASG application and Pipeline deploy action meets that minimally. AppSpec permission grants or Image Builder AMI swaps add unneeded complexity. This follows AWS DevOps best practice to use managed, scalable primitives with least privilege and automated remediation for production reliability.
Why the others are wrong
B. misplaces CodeDeploy access in AppSpec rather than IAM plus agent setup
C. introduces Image Builder AMI creation, contrary to in-place RPM update
E. targets individual instances instead of the group, breaking scaling cohesion
DOP-C02 exam tip
RPM to ASG via Pipeline equals agent AMI plus IAM plus in-place ASG app with CodeDeploy action.
8A company’s security team requires that all external Application Load Balancers (ALBs) and Amazon API Gateway APIs are associated with AWS WAF web ACLs. The company has hundreds of AWS accounts, all of which are included in a single organization in AWS Organizations. The company has configured AWS Config for the organization. During an audit, the company finds some externally facing ALBs that are not associated with AWS WAF web ACLs.
Which combination of steps should a DevOps engineer take to prevent future violations? (Choose two.)
Delegate AWS Firewall Manager to a security account.
Delegate Amazon GuardDuty to a security account.
Create an AWS Firewall Manager policy to attach AWS WAF web ACLs to any newly created ALBs and API Gateway APIs.
Create an Amazon GuardDuty policy to attach AWS WAF web ACLs to any newly created ALBs and API Gateway APIs.
Configure an AWS Config managed rule to attach AWS WAF web ACLs to any newly created ALBs and API Gateway APIs.
Answer: A, C
The short version
AC — Delegate Firewall Manager and enforce WAF attachment. Central policy auto-attaches web ACLs to new ALBs and APIs across the org.
Key concepts in this question
Firewall Manager: centrally manages WAF, Shield, and security groups across Organizations
Delegated admin: security account owns policy while member accounts inherit enforcement
Preventive policy: attaches ACLs at creation, unlike detective Config rules that only flag
GuardDuty: detects threats but does not attach WAF ACLs
Why AC is correct
Hundreds of accounts need guardrails that prevent future misses, not just audits of past ones. Delegating Firewall Manager to security plus a WAF-attachment policy ensures every new externally facing ALB and API gets a web ACL automatically. Config can detect but cannot natively remediate attachment at scale. This follows AWS DevOps best practice to use managed, scalable primitives with least privilege and automated remediation for production reliability.
Why the others are wrong
B. delegates threat detection without WAF enforcement capability
D. invents GuardDuty attachment policies that do not exist for WAF
E. relies on Config rules that detect drift but do not auto-attach ACLs
DOP-C02 exam tip
Prevent missing WAF org-wide equals Firewall Manager delegated plus auto-attach policy, not GuardDuty or Config alone.
9A company uses AWS Key Management Service (AWS KMS) keys and manual key rotation to meet regulatory compliance requirements. The security team wants to be notified when any keys have not been rotated after 90 days.
Which solution will accomplish this?
Configure AWS KMS to publish to an Amazon Simple Notification Service (Amazon SNS) topic when keys are more than 90 days old.
Configure an Amazon EventBridge event to launch an AWS Lambda function to call the AWS Trusted Advisor API and publish to an Amazon Simple Notification Service (Amazon SNS) topic.
Develop an AWS Config custom rule that publishes to an Amazon Simple Notification Service (Amazon SNS) topic when keys are more than 90 days old.
Configure AWS Security Hub to publish to an Amazon Simple Notification Service (Amazon SNS) topic when keys are more than 90 days old.
Answer: C
The short version
C — Config custom rule notifies on stale KMS keys. Manual rotation needs a compliance check that publishes to SNS past 90 days.
Key concepts in this question
Manual rotation: customer creates new key material, so AWS does not auto-alert on age
Custom Config rule: evaluates key age metadata and flags noncompliance for notification
KMS native publish: no built-in age-based SNS on key staleness
Trusted Advisor and Security Hub: useful signals but not the direct key-age compliance mechanism
Why C is correct
Regulatory 90-day rotation with manual keys demands a purpose-built age evaluation. A Config custom rule can inspect last-rotation time and publish to SNS when exceeded. Generic KMS publishing or Security Hub defaults do not provide that precise age gate. This follows AWS DevOps best practice to use managed, scalable primitives with least privilege and automated remediation for production reliability.
Why the others are wrong
A. assumes KMS natively emits age alerts, which it does not for manual rotation
B. chains EventBridge plus Trusted Advisor indirectly instead of direct age compliance
D. relies on Security Hub findings that lack the specific 90-day rotation trigger
DOP-C02 exam tip
Manual KMS rotation plus age alert equals Config custom rule to SNS: evaluate key age, notify on noncompliance.
10A security review has identified that an AWS CodeBuild project is downloading a database population script from an Amazon S3 bucket using an unauthenticated request. The security team does not allow unauthenticated requests to S3 buckets for this project.
How can this issue be corrected in the MOST secure manner?
Add the bucket name to the AllowedBuckets section of the CodeBuild project settings. Update the build spec to use the AWS CLI to download the database population script.
Modify the S3 bucket settings to enable HTTPS basic authentication and specify a token. Update the build spec to use cURL to pass the token and download the database population script.
Remove unauthenticated access from the S3 bucket with a bucket policy. Modify the service role for the CodeBuild project to include Amazon S3 access. Use the AWS CLI to download the database population script.
Remove unauthenticated access from the S3 bucket with a bucket policy. Use the AWS CLI to download the database population script using an IAM access key and a secret access key.
Answer: C
The short version
C — Block public S3 and use the CodeBuild role with CLI. Bucket policy removes unauthenticated access while the service role grants least-privilege download.
Key concepts in this question
Unauthenticated S3: anonymous reads violate policy and expose supply-chain risk
Service role: CodeBuild assumes a role that can be granted precise S3 read rights
Bucket policy deny: enforces no public access regardless of ACLs
Long-lived keys and basic auth: add secret sprawl versus temporary role credentials
Why C is correct
The most secure fix eliminates anonymous access at the bucket and authenticates via the ephemeral CodeBuild service role over AWS CLI. That preserves automation without storing access keys or inventing HTTP passwords. It enforces least privilege with native IAM and bucket controls. This follows AWS DevOps best practice to use managed, scalable primitives with least privilege and automated remediation for production reliability.
Why the others are wrong
A. whitelists the bucket but may retain unauthenticated request patterns
B. adds custom HTTP auth outside IAM, weaker and harder to audit
D. introduces static access keys that can leak and need rotation
DOP-C02 exam tip
CodeBuild needs private S3 securely equals deny public plus role-based CLI access, never static keys or anonymous reads.