Environments and configuration
DVA-C03 · Lesson 16 of 24 · 2:15:26
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the DVA-C03 exam (AWS Certified Developer – Associate). In this lesson: where each setting belongs (environment variables, Parameter Store, Secrets Manager, AppConfig), AppConfig feature flags, validators, and deployment strategies, Lambda versions and aliases, API Gateway stages and stage variables, custom domains, and environments for container images and Amplify Hosting. Includes three original practice questions.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Test calls production
At AnyCompany Tickets, changing a discount threshold meant a new deployment of the pricing function. The test API called the production function by mistake. And the mobile app had the stage name of the API in its base URL. This lesson covers where configuration goes, AppConfig, Lambda aliases, API Gateway stages and endpoints, and environments in other services.
Where configuration goes
Each kind of setting has its place. Environment variables hold the simple settings of one function, and a published version freezes them with the code. Parameter Store holds settings shared by several services, in a hierarchy per environment, like slash tickets, slash test. Secrets Manager holds credentials, with rotation. And AWS AppConfig holds the settings that change while the app runs, like feature flags, without any deployment of code.
AWS AppConfig
In AppConfig, an application has environments, like test and production, and configuration profiles, either feature flags or free-form data. Validators check each new version before it is deployed, with a JSON Schema or a Lambda function. A deployment strategy rolls the change out gradually, and when a CloudWatch alarm of the environment goes off, AppConfig rolls the change back by itself. In a function, the AppConfig Agent extension caches the configuration, and the code reads it from a local endpoint.
Versions and aliases
In Lambda, a published version is an immutable snapshot of the code and the settings of a function, with its own number, while new changes stay on LATEST. An alias, like test or prod, is a named pointer to a version, with an ARN that never changes, so callers and triggers keep working when you publish. Moving the alias to a new version is a deployment, and moving it back is a rollback. And a weighted alias can split traffic between two versions, as lesson twenty shows.
Stages and stage variables
In API Gateway, a deployment is a snapshot of the API, and a stage, like test or prod, serves a deployment at its own URL, with the stage name at the end. Each stage has its own settings: throttling, caching, logging, and canary releases. Stage variables are key-value pairs of a stage, used in the integrations, so one API definition can call the test alias in test, and the prod alias in prod. Lambda must allow each alias to be invoked by the API. And stage variables are not meant for secrets.
Endpoints and custom domains
An API has one of three endpoint types. Edge-optimized sends requests through the nearest CloudFront point of presence, Regional serves clients in the same Region, and private can only be reached from a VPC, through an interface endpoint. A custom domain name replaces the default URL, with a certificate from ACM, and API mappings send each base path to an API and a stage. Once clients use the custom domain, you can turn off the default endpoint.
Branches and other environments
Other services have their own environments. Amplify Hosting deploys each connected Git branch as an environment, at its own URL, and it can deploy every feature branch that matches a pattern, with previews of pull requests and password protection. Container images get one tag per release, and that same image moves from test to production. And AWS Copilot set up test and production environments for container services, but it reached end of support in June 2026, so new projects choose other tools.
Recap
Let's recap. Environment variables are frozen in a version, Parameter Store and Secrets Manager hold shared settings and credentials, and AppConfig changes settings at run time. AppConfig validates each change, rolls it out gradually, and rolls it back on an alarm. Lambda aliases are stable pointers to versions, for deployments and rollbacks. API Gateway stages have their own URL and settings, and stage variables pick the backend for each stage. And Amplify deploys Git branches as environments, while images move between environments by tag.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
Marketing changes the threshold of a ticket discount several times a day, without any code deployment. A wrong value must be caught before it goes out, and rolled back if errors rise. What should the developer use?
- An environment variable of the pricing function
- AWS AppConfig, with a validator and an alarm
- A String parameter in Parameter Store
- A secret in Secrets Manager
Show the answer
AWS AppConfig, with a validator and an alarm
AppConfig validates each new value, rolls it out gradually, and rolls it back when an alarm goes off. “An environment variable of the pricing function” would need a new deployment of the function for every change. “A String parameter in Parameter Store” would avoid deployments, but nothing would check the value or roll it back. And “A secret in Secrets Manager” would be for credentials, not for a business setting.
One API definition must call the test alias of a function from its test stage, and the prod alias from its prod stage. What should the developer configure?
- Two copies of the API, one for each environment
- An environment variable in the function
- A custom domain name for each stage
- A stage variable that names the alias
Show the answer
A stage variable that names the alias
A stage variable in the integration names the alias, so each stage calls its own alias, once Lambda allows the API to invoke both. “Two copies of the API, one for each environment” would duplicate the definition, which then drifts between environments. “An environment variable in the function” would change a setting inside the function, not which function the API calls. And “A custom domain name for each stage” would give each stage a name, while both stages would still call the same function.
The web team wants every feature branch of the ticket shop to get its own deployed copy for reviewers, automatically, with no new pipeline to write. The site is hosted on Amplify. What should the developer turn on?
- Pattern-based feature branch deployments
- A new API Gateway stage for each branch
- A Lambda version for each branch
- Password protection on the main branch
Show the answer
Pattern-based feature branch deployments
Amplify Hosting deploys every branch that matches a pattern, each at its own URL. “A new API Gateway stage for each branch” would give the API new stages, without deploying the web app of each branch. “A Lambda version for each branch” would publish new versions of a function, not copies of the site. And “Password protection on the main branch” would protect the main site, without creating any copy for reviewers.