DOP-C02 exam dumps

DOP-C02 practice question 122 of 411

AWS Certified DevOps Engineer - Professional. Professional level, Amazon Web Services. Free question with the correct answer and a full explanation.

DOP-C02 Question 122

Single answer

Your company uses AWS CodePipeline for CI/CD workflows to deploy a serverless application. A recent deployment failed due to a bug introduced in the Lambda function code, which caused production downtime. The development team has implemented unit tests to catch such issues earlier. How can you ensure that future deployments do not proceed to production if the unit tests fail, while still automating the workflow?

  1. A

    Add a manual approval action before the deployment to production.

  2. B

    Integrate a test stage in the CodePipeline to run unit tests using AWS CodeBuild.

  3. C

    Enable AWS Lambda retries to automatically reprocess failed requests.

  4. D

    Use Amazon CloudWatch Alarms to monitor for failed invocations and halt the pipeline.

Show answer and explanation

Correct answer: B

Explanation

The best way to automate the prevention of faulty deployments is to integrate a test stage in the CodePipeline that runs unit tests using AWS CodeBuild. This ensures that any failures in unit tests will stop the pipeline, preventing the deployment of buggy code to production. This approach maintains the automation of CI/CD workflows while enhancing the reliability of the deployment process.

  • A. Incorrect.

    Adding a manual approval action can prevent faulty deployments, but it eliminates the automated nature of the CI/CD pipeline. This option does not address the specific requirement of automating the workflow while catching unit test failures.

  • B. Correct.

    Integrating a test stage in AWS CodePipeline with AWS CodeBuild allows you to run unit tests automatically as part of the pipeline. If the tests fail, the pipeline stops, ensuring that faulty code does not reach production. This meets both the automation and quality requirements.

  • C. Incorrect.

    Enabling AWS Lambda retries only helps in processing failed requests but does not prevent faulty code from being deployed. This is unrelated to catching unit test failures during deployment.

  • D. Incorrect.

    Using Amazon CloudWatch Alarms to monitor failed invocations is a reactive approach that occurs post-deployment. It does not prevent faulty deployments from proceeding to production.

Timed practice exam

Take a DOP-C02 practice test under exam conditions

75 questions in 180 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam