DVA-C02 exam dumps

DVA-C02 practice question 201 of 399

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

DVA-C02 Question 201

Single answer

You are deploying a Node.js application to AWS Elastic Beanstalk. The application requires a database connection string, which should not be hardcoded into the application's source code for security purposes. How can you inject the database connection string into the application in a secure and manageable way?

  1. A

    Define the database connection string as an environment variable in the Elastic Beanstalk environment configuration.

  2. B

    Include the database connection string in the application's source code and upload it to Elastic Beanstalk.

  3. C

    Store the database connection string in an AWS Secrets Manager secret and fetch it dynamically within the application.

  4. D

    Use an EC2 instance metadata endpoint to retrieve the database connection string at runtime.

Show answer and explanation

Correct answer: A

Explanation

Environment variables are a secure and manageable way to inject sensitive information, like database connection strings, into applications running on AWS Elastic Beanstalk. This keeps the sensitive data out of the application’s source code and allows for centralized management directly in the Elastic Beanstalk environment configuration.

  • A. Correct.

    This is the correct approach. Elastic Beanstalk allows you to define environment variables in its environment configuration, which can then be accessed by the application. This keeps sensitive information out of the source code while making it manageable.

  • B. Incorrect.

    This is insecure and not recommended because it exposes sensitive information to anyone with access to the source code.

  • C. Incorrect.

    While AWS Secrets Manager is a secure option for storing secrets, this approach would require additional setup and is not directly supported by Elastic Beanstalk's native environment variable configuration mechanism.

  • D. Incorrect.

    The EC2 instance metadata endpoint is not designed for securely retrieving application-specific secrets like database connection strings.

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