DOP-C02 exam dumps

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

Single answer

Your team is managing a CI/CD pipeline using AWS CodePipeline. Recently, you observed that deployment failures are occurring due to missing environment variables in the Elastic Beanstalk environment during the deployment phase. You need to ensure that all required environment variables are correctly defined before the deployment proceeds. How can you address this issue in the most automated and efficient way?

  1. A

    Use AWS Elastic Beanstalk's configuration files (.ebextensions) to define the required environment variables during the application deployment.

  2. B

    Add a pre-deployment stage to the CodePipeline that uses an AWS Lambda function to validate the existence of required environment variables in the Elastic Beanstalk environment.

  3. C

    Manually configure the environment variables in the Elastic Beanstalk console before every deployment.

  4. D

    Use AWS Systems Manager Parameter Store to store the environment variables and configure Elastic Beanstalk to retrieve them during deployment.

Show answer and explanation

Correct answer: B

Explanation

The most efficient and automated solution to prevent deployment failures due to missing environment variables is to add a pre-deployment validation stage in the pipeline. By using an AWS Lambda function to validate the existence of required environment variables in the Elastic Beanstalk environment, the pipeline can catch issues early and avoid proceeding with a broken deployment. This aligns with the principles of CI/CD and ensures a reliable deployment process.

  • A. Incorrect.

    Using .ebextensions to define the environment variables is a valid approach, but it does not validate their existence before deployment. This option does not solve the problem of preventing deployment failures due to missing variables.

  • B. Correct.

    Adding a pre-deployment stage to the pipeline with an AWS Lambda function to validate the environment variables is an automated and efficient solution. The Lambda function can check whether all required variables are configured, and the pipeline can fail early if validation fails, preventing deployment issues.

  • C. Incorrect.

    Manually configuring the environment variables before each deployment is not efficient or automated. This approach increases the risk of human error and is not suitable for a CI/CD pipeline.

  • D. Incorrect.

    Using AWS Systems Manager Parameter Store to store environment variables is a good practice for securely managing secrets and configurations. However, there is no direct mechanism to validate their existence in Elastic Beanstalk during deployment using this approach.

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