DOP-C02 exam dumps

DOP-C02 practice question 241 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 241

Single answer

Your organization is using AWS CodePipeline to automate the release process for a web application. As part of the deployment pipeline, you need to ensure that the application passes automated functional tests before it is deployed to the production environment. These tests should only run when changes are pushed to the 'main' branch of the source repository. Which solution will best meet this requirement?

  1. A

    Use CodePipeline with a source stage configured to trigger on changes to the 'main' branch, followed by a test stage that executes the functional tests.

  2. B

    Configure a CloudWatch Events rule to trigger the functional tests whenever an AWS CodeCommit push occurs, regardless of the branch.

  3. C

    Use AWS CodeDeploy directly to run the functional tests before deploying the application to the production environment.

  4. D

    Use CodePipeline with a condition in the test stage that validates whether the source branch is 'main' before running the tests.

Show answer and explanation

Correct answer: A

Explanation

The best solution for ensuring functional tests run only on changes to the 'main' branch is to configure AWS CodePipeline with a source stage that triggers on changes to the 'main' branch. This approach integrates seamlessly with the pipeline and ensures that functional tests are executed before deployment to production. Other options either lack the necessary branch filtering or misapply the purpose of AWS services.

  • A. Correct.

    This is the correct solution. CodePipeline can be configured to trigger based on changes to a specific branch, such as 'main'. Functional tests can then be added as a dedicated stage in the pipeline to ensure that changes are validated before deployment.

  • B. Incorrect.

    This is incorrect because triggering functional tests through a CloudWatch Events rule would not allow you to restrict the tests to only changes on the 'main' branch.

  • C. Incorrect.

    This is incorrect as AWS CodeDeploy is primarily used for deploying applications and does not natively handle functional test execution as part of a deployment pipeline.

  • D. Incorrect.

    This is incorrect because CodePipeline does not support conditional logic directly within stages. Conditions like branch validation should be handled in the source stage configuration.

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