DVA-C02 exam dumps

DVA-C02 practice question 218 of 399

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

DVA-C02 Question 218

Single answer

You are preparing to deploy a Node.js application to AWS using AWS Elastic Beanstalk. The application requires certain environment variables to be set, and you need to ensure they are applied during deployment. How should you prepare the application artifacts to include the environment variables?

  1. A

    Include a .ebextensions directory in the application source bundle and define the environment variables in configuration files within this directory.

  2. B

    Add the environment variables directly in the source code of your application.

  3. C

    Use the Elastic Beanstalk console to define environment variables after deploying the application artifacts.

  4. D

    Include a Dockerfile in the application source bundle that explicitly defines the environment variables.

Show answer and explanation

Correct answer: A

Explanation

When deploying applications to AWS Elastic Beanstalk, you can include a .ebextensions directory in the application source bundle. Inside this directory, you define configuration files (in YAML format) to specify environment variables and other settings. This approach ensures the environment variables are set up during the deployment process and avoids hardcoding sensitive information into your application code.

  • A. Correct.

    This is correct. You can include a .ebextensions directory in the source bundle, and define environment variables in YAML configuration files. This ensures the variables are applied during deployment.

  • B. Incorrect.

    This is incorrect. Hardcoding environment variables directly into the source code is not a best practice as it can expose sensitive data and make the application less flexible.

  • C. Incorrect.

    This is incorrect. While you can define environment variables using the Elastic Beanstalk console, the question specifically asks about preparing the application artifacts before deployment.

  • D. Incorrect.

    This is incorrect. A Dockerfile is used for containerizing applications and defining their runtime environment, but this approach is not specific to setting environment variables through Elastic Beanstalk configuration.

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