DVA-C02 Deployment Practice Question
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?
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
✓
.ebextensions/*.config
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.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
package.json
Why it's wrong here
package.json is a manifest file primarily used in Node.js projects to define application metadata, scripts, and, most importantly, project dependencies managed by npm or yarn. While it can define scripts that might utilize environment variables during execution, it does not serve as a mechanism for directly setting or storing environment variables that the application will access at runtime within an AWS Elastic Beanstalk environment. Elastic Beanstalk requires a distinct configuration method for environment properties.
- ✓
.ebextensions/*.config
Why this is correct
.ebextensions/*.config files are the correct and recommended approach for customizing and configuring AWS Elastic Beanstalk environments. These YAML or JSON formatted files, placed within the .ebextensions directory at the root of the application source bundle, enable developers to define environment properties, modify EC2 instance settings, install packages, and execute custom commands. Specifically, application environment variables are configured under the 'option_settings' section using the 'aws:elasticbeanstalk:application:environment' namespace.
- ✗
Dockerfile
Why it's wrong here
A Dockerfile is a script containing instructions for building a Docker image, which encapsulates an application and its dependencies into a portable container. While a Dockerfile can define environment variables using the 'ENV' instruction, these variables are scoped to the Docker container itself and are relevant only for Docker-based Elastic Beanstalk environments. For a standard Node.js application deployed directly to Elastic Beanstalk without Docker, a Dockerfile is not the appropriate mechanism for setting host-level application environment variables.
- ✗
buildspec.yml
Why it's wrong here
buildspec.yml is a configuration file exclusively utilized by AWS CodeBuild to define the build commands and settings for a build project. It specifies the various build phases (e.g., install, pre_build, build, post_build), the commands to execute within each phase, and the artifacts to produce. Although CodeBuild might be part of a larger CI/CD pipeline that deploys to Elastic Beanstalk, buildspec.yml itself does not directly configure or manage environment variables within the Elastic Beanstalk application environment.
Go deeper
Related to this question
About these practice questions
Courseiva writes every DVA-C02 question from scratch — 1,135 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
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.