DOP-C02 Configuration Management and IaC Practice Question
A DevOps team uses Elastic Beanstalk to deploy a web application. They want to configure environment variables without modifying the application code. Where should they define these variables?
⚠ Common exam trap
DOP-C02 often tests whether candidates confuse EC2 User Data (bootstrapping) or instance metadata (instance info) with Elastic Beanstalk environment properties, which are the correct mechanism for externalized app configuration.
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
✓
As environment properties in the Elastic Beanstalk environment
Elastic Beanstalk environment properties are key-value pairs defined in the environment configuration that are injected as environment variables into the application's runtime. They allow configuration changes without modifying application code, and can be set via the console, CLI, or .ebextensions. This is the standard mechanism for externalizing configuration in 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.
- ✓
As environment properties in the Elastic Beanstalk environment
Why this is correct
Elastic Beanstalk's native Environment Properties are key-value pairs defined at the environment level and injected directly into the operating system as environment variables on each EC2 instance, or as container environment variables for ECS-based platforms. This allows platform-managed settings to be consumed by your application with no extra code, and they are automatically updated on configuration changes without requiring a new deployment. They also support encrypted values when set through the AWS CLI or saved configurations with KMS, making them the standard, service-supported approach.
- ✗
In the EC2 User Data script
Why it's wrong here
An EC2 User Data script executes only once during initial instance bootstrap, and any environment variables it exports are confined to that shell session, disappearing on reboot or after the process exits. Using it to configure your app would also duplicate logic across instances and fail on instance replacements during rolling or immutable deployments, as Elastic Beanstalk would not apply those variables to the new fleet. Furthermore, it is not a declarative configuration mechanism, offers no centralized management, and can accidentally expose secrets in the system log.
- ✗
In the instance metadata
Why it's wrong here
Instance metadata (IMDS) is a service provided by the AWS hypervisor that offers immutable facts about the instance—such as instance ID, AMI ID, instance type, and network info—but it does not automatically include any custom application configuration or user-defined key-value pairs. While you could write a script to publish your own data to an instance metadata endpoint, that is not a supported or scalable pattern on Elastic Beanstalk, and the feature is intended for AWS-internal data, not app settings. Reading metadata also requires retrieval code and does not integrate with Elastic Beanstalk's health, rollback, or update mechanisms.
- ✗
In the application code
Why it's wrong here
Embedding configuration values directly in the application source code couples your software to a specific environment, so promoting a build from staging to production requires modifying, recompiling, and redeploying the artifact, which negates the benefit of immutable deployment pipelines. It also bypasses Elastic Beanstalk's configuration management features, prevents operations teams from adjusting settings without code review, and creates a security risk if secrets are committed to version control. According to the twelve-factor app methodology, environment-specific configuration must be externalized to the runtime environment, not hard-coded.
Go deeper
Related to this question
About these practice questions
Courseiva writes every DOP-C02 question from scratch — 1,298 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 and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Amazon Web Services exam blueprint
This DOP-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 DOP-C02 exam.