Courseiva
Deployment →mediumMultiple Choice

DVA-C02 Deployment Practice Question

A developer is using AWS Elastic Beanstalk to deploy a web application. The application requires custom configuration, such as setting environment variables for the EC2 instances. Which file should the developer include in the application source bundle under the appropriate directory to achieve this?

⚠ Common exam trap

Candidates often confuse Elastic Beanstalk configuration files with other AWS service configuration files (CodeBuild's `buildspec.yml` or CodeDeploy's `appspec.yml`) or assume `cron.yaml` can handle general environment settings, leading them to pick a wrong option based on familiarity with other services.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Include a .ebextensions/options.config file.

AWS Elastic Beanstalk uses `.ebextensions` directory with `.config` files (e.g., `options.config`) to define custom configuration, including environment variables for EC2 instances. These YAML or JSON files are processed during environment creation and updates, allowing you to set `option_settings` that override or augment the default platform configuration.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Include a buildspec.yml file in the root directory.

    Why it's wrong here

    The buildspec.yml file is read exclusively by AWS CodeBuild during the build phase of a CI/CD pipeline to specify install, pre_build, build, and post_build commands along with artifact locations; it has no role in Elastic Beanstalk environment provisioning, and Elastic Beanstalk never parses or executes this file.

  • ✓

    Include a .ebextensions/options.config file.

    Why this is correct

    Placing a YAML or JSON file with a .config extension inside the .ebextensions directory at the root of the source bundle lets Elastic Beanstalk apply option_settings such as aws:elasticbeanstalk:application:environment during deployment, which is exactly how environment variables and other instance-level customizations like packages, commands, and container settings get injected.

  • ✗

    Include an appspec.yml file.

    Why it's wrong here

    appspec.yml is the deployment specification consumed by AWS CodeDeploy to define lifecycle event hooks such as BeforeInstall, AfterInstall, and ApplicationStart plus file mappings for EC2/on-premises or Lambda deployments; the Elastic Beanstalk platform itself does not read or act on this file even when CodeDeploy coexists with a Beanstalk deployment.

  • ✗

    Include a cron.yaml file.

    Why it's wrong here

    cron.yaml is a legacy Elastic Beanstalk worker-tier file used solely to schedule periodic tasks that get pushed to an SQS queue and processed by the worker daemon; it has no option_settings mechanism and therefore cannot set arbitrary environment variables on the underlying EC2 instances.

About these practice questions

One of 1,135 original DVA-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

3 more ways this is tested on DVA-C02

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A developer is deploying a Node.js application to AWS Elastic Beanstalk. The application needs to read environment-specific configuration variables. Which configuration file should the developer use to define these variables within the Elastic Beanstalk environment?

easy
  • A.package.json
  • ✓ B..ebextensions/*.config
  • C.Dockerfile
  • D.buildspec.yml

Why B: Ebextensions/*.config files in YAML or JSON format are used to define environment-specific configuration, including environment variables, in Elastic Beanstalk. Option A is wrong because package.json is for Node.js dependencies and cannot set environment variables. Option C is wrong because Dockerfile is for Docker containers, not Elastic Beanstalk configuration. Option D is wrong because buildspec.yml is used by AWS CodeBuild, not Elastic Beanstalk.

Variation 2. A developer is deploying a Node.js application to AWS Elastic Beanstalk. The application uses environment variables for database credentials. What is the BEST way to securely provide these credentials to the application?

easy
  • A.Store the credentials in a file in the source code repository.
  • B.Store the credentials in the application's configuration file within the deployment package.
  • C.Hardcode the credentials in the application code.
  • ✓ D.Set environment properties in the Elastic Beanstalk environment configuration.

Why D: Elastic Beanstalk allows you to set environment properties in the environment configuration, which are injected as environment variables into the application's runtime. This approach keeps sensitive credentials out of the source code and deployment artifacts, adhering to the principle of least privilege and secure credential management. For a Node.js application, these environment variables can be accessed via `process.env`, providing a secure and flexible way to manage database credentials without hardcoding or storing them in files.

Variation 3. A developer is deploying a web application on AWS Elastic Beanstalk. The application uses a relational database and requires a custom environment variable for the database connection string. The developer has created an Elastic Beanstalk environment and wants to set the environment variable securely without exposing it in the source code or configuration files. The developer also wants to ensure that the environment variable is available to the application instances at deployment time. What is the BEST way to achieve this?

medium
  • ✓ A.Set the environment variable using the Elastic Beanstalk console or CLI by configuring environment properties.
  • B.Store the connection string in AWS Systems Manager Parameter Store and retrieve it from the application code at runtime.
  • C.Hardcode the connection string in the application code and commit it to the source repository.
  • D.Store the connection string in a file named 'env.txt' in the application source bundle and read it at application startup.

Why A: Configuring environment properties in Elastic Beanstalk via the console or CLI is the best way to securely set environment variables without exposing them in source code or configuration files. These properties are injected into the application environment at deployment time and are stored securely by Elastic Beanstalk. They are not visible in the source repository and can be managed centrally. This method also allows for easy updates and separation of configuration from code.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DVA-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DVA-C02 exam.