DVA-C02 exam dumps

DVA-C02 practice question 270 of 399

AWS Certified Developer - Associate. Associate level, Amazon Web Services. Free question with the correct answer and a full explanation.

DVA-C02 Question 270

Single answer

You are working on a CI/CD pipeline for an application hosted in AWS. The pipeline uses AWS CodePipeline and AWS CodeBuild. The development team works with two branches: 'dev' for development and 'main' for production. The requirement is that changes pushed to the 'dev' branch should trigger a build and deploy to a staging environment, while changes pushed to the 'main' branch should trigger a build and deploy to the production environment. How would you configure this workflow efficiently in AWS CodePipeline?

  1. A

    Create two separate CodePipeline pipelines: one for 'dev' and one for 'main', and configure each pipeline with its respective branch and deployment stage.

  2. B

    Use a single CodePipeline with two stages: one for 'dev' and one for 'main', and add conditional logic in the stages to deploy to the appropriate environment.

  3. C

    Use a single CodePipeline, configure two source actions (one for 'dev' and one for 'main'), and add separate build and deploy stages for each branch.

  4. D

    Create a single CodePipeline with a source action configured for the 'main' branch and use manual approval for deploying changes from the 'dev' branch to the staging environment.

Show answer and explanation

Correct answer: C

Explanation

The best practice for implementing a CI/CD workflow with multiple branches in AWS CodePipeline is to use a single pipeline and configure separate source actions for each branch. This allows you to create distinct build and deploy stages for each branch, ensuring changes are automatically deployed to the correct environment without duplication or manual intervention. This approach is efficient, scalable, and aligns with the principles of automation in CI/CD.

  • A. Incorrect.

    This approach is inefficient because it duplicates pipelines for each branch, leading to higher maintenance overhead.

  • B. Incorrect.

    Conditional logic in stages is not natively supported in CodePipeline. This approach is not feasible with the current capabilities of AWS CodePipeline.

  • C. Correct.

    This is the correct option. By configuring two source actions for 'dev' and 'main' and adding separate build and deploy stages for each branch, you can efficiently manage the CI/CD workflow for both branches in a single pipeline.

  • D. Incorrect.

    This approach does not meet the requirement to automatically deploy changes from the 'dev' branch to the staging environment. It introduces manual intervention, which is against the automation principles of CI/CD.

Timed practice exam

Take a DVA-C02 practice test under exam conditions

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

Start timed exam