AWS Elastic Beanstalk

A Platform-as-a-Service (PaaS) orchestration layer: you upload application code, Elastic Beanstalk provisions and manages the underlying EC2 instances, Auto Scaling group, load balancer, security groups, and CloudWatch monitoring — while still handing you full access to the underlying resources if you need it. This module pairs "how it actually works" understanding with the exam-reasoning layer DVA-C02 tests, especially around deployment options and where Beanstalk sits relative to ECS/Fargate and Lambda.

Compute — Deployment orchestration PaaS — infrastructure abstracted, not hidden Free service — you pay only for underlying resources
5
Deployment policies (in-environment)
2
Environment tiers (Web server / Worker)
2
Health reporting levels (Basic / Enhanced)
$0
Elastic Beanstalk service fee itself

Environment Health Colors — Memorize This

GREENPassing checks
YELLOWOne+ warnings
REDOne+ severe / majority failing
GREYNo data / processes suspended

What Elastic Beanstalk Actually Is

The Core Mechanism — Not Just "Auto-Deploy My Code"

Core Components

Application

A logical container for your deployable code — versions, environments, and configurations all belong to one application. Think of it as the top-level project folder in the Elastic Beanstalk console.

Application Version

A specific, labeled, deployable iteration of your code (a ZIP/WAR file, or a Dockerrun.aws.json for Docker platforms), stored in an Elastic Beanstalk-managed S3 bucket. You deploy application versions into environments — this is what makes rollback possible (redeploy an older version).

Environment

A running collection of AWS resources (EC2/ASG/ELB/security groups/etc.) executing one application version at a time. You typically run multiple environments per application (e.g. myapp-dev, myapp-staging, myapp-prod), each with its own configuration and URL/CNAME.

Environment Configuration

The full set of parameters describing an environment — instance type, deployment policy, Auto Scaling min/max, environment variables, VPC/subnets, health reporting level, etc. Can be captured as a reusable "saved configuration" and applied to new environments.

Platform

The managed runtime + OS + web/app server + language dependencies stack Beanstalk provisions on your instances (e.g. Node.js on Amazon Linux 2023, Python, Java (Corretto/Tomcat), .NET on Windows Server, Docker, Go, Ruby, PHP). AWS maintains "platform versions" you can upgrade to; you can also build a fully custom platform with Packer if none of the managed ones fit.

Environment Tier

Chosen at environment creation: Web server tier (fronted by a load balancer, serves HTTP requests) or Worker tier (no load balancer; polls an Amazon SQS queue and processes messages in the background). Cannot be changed after creation without recreating the environment.

How Elastic Beanstalk Actually Works — Deployment Flow

Package

Developer packages source code as a ZIP/WAR (or a Dockerrun.aws.json for Docker), optionally including an .ebextensions/.platform folder with configuration files

Upload

Console upload, EB CLI (eb deploy), or a CI/CD pipeline (e.g. CodePipeline) uploads the bundle — Elastic Beanstalk stores it as a new Application Version in its managed S3 bucket

Orchestration

Elastic Beanstalk generates/updates an AWS CloudFormation stack that provisions or updates EC2 instances, the Auto Scaling group, the load balancer, security groups, and CloudWatch alarms to match the environment configuration

EC2 fleetAuto Scaling groupELB (Classic/ALB/NLB)Security groupsCloudWatch alarms
Deployment Policy Applied

The chosen policy — All at once / Rolling / Rolling with additional batch / Immutable / Traffic Splitting — governs exactly how the new application version replaces the old one across the fleet

Health Reporting

The Basic or Enhanced health agent on each instance reports application and instance status back to the Elastic Beanstalk health dashboard and to CloudWatch

Traffic

Requests reach the environment via its Beanstalk-assigned CNAME (or a custom domain mapped through Route 53). For blue/green releases, a second environment is built, tested independently, then cut over via an environment swap (CNAME swap)

⚠️ The Recurring Exam Theme

Nearly every Elastic Beanstalk question tests one of three things: (1) can you pick the right deployment policy for a described downtime/cost/rollback requirement, (2) do you know Beanstalk is PaaS with retained infrastructure access — the deciding factor against Lambda (no server access) and a lighter-weight alternative to self-managing ECS/Fargate, or (3) can you spot the operational traps: .ebextensions secrets in source control, RDS coupled to an environment, or environment-variable changes triggering a redeploy.

Exam Domain Mapping

DVA-C02 DomainWhere Elastic Beanstalk Shows Up
Domain 1 — Development with AWS ServicesPackaging application versions, using the EB CLI, structuring .ebextensions/.platform config, worker tier + SQS integration
Domain 2 — SecurityInstance profile vs service role, environment variables vs Secrets Manager/SSM Parameter Store for credentials, VPC placement
Domain 3 — DeploymentThe centerpiece domain for this service — deployment policy selection, blue/green via environment swap, CI/CD integration with CodePipeline/CodeBuild/CodeDeploy
Domain 4 — Troubleshooting & OptimizationReading the health dashboard, Basic vs Enhanced health reporting, diagnosing a failed deployment, log retrieval (bundle logs / instance logs)

Exact weightings shift slightly between guide revisions, but deployment strategy questions (Domain 3) are the single most reliable place Elastic Beanstalk appears on DVA-C02.

Final Summary

Must Memorize
  • The 5 deployment policies and their downtime/cost/rollback tradeoffs
  • Blue/Green = environment swap (CNAME swap), not one of the deployment-policy radio options
  • Worker tier = SQS-backed, no load balancer
  • Elastic Beanstalk has no service fee — you pay for underlying resources
  • Enhanced health reporting = OS + application metrics; Basic = pass/fail only
Must Understand
  • Why full infrastructure access (SSH, security groups) separates Beanstalk from Lambda
  • .ebextensions mechanics: option_settings, Resources, packages, container_commands, leader_only
  • Decoupling RDS from the environment for production durability
  • Environment variable changes trigger a redeployment, not an instant in-place change
Can De-prioritize
  • Exact console click-paths / menu locations
  • Historical Classic Load Balancer configuration details
  • Building fully custom platforms with Packer (know it exists, not the syntax)

Exam appearance probability: HIGH

Related guides: 01 — Containers (ECS/ECR/Fargate/EKS) · 02 — CI/CD Pipeline services · 08 — Cross-Service Architectures

Components & Configuration Deep Dive

The settings and mechanics that most commonly appear inside DVA-C02 scenario questions — deployment options in full, health monitoring, .ebextensions, and environment variables.

Deployment Policies — In-Environment (In-Place) Options

All at Once Fastest, least safe
MechanicsDeploys the new version to every instance simultaneously
DowntimeYes — brief outage while instances restart the application
Extra costNone — no additional instances
RollbackManual — must trigger a new deployment of the previous application version
Rolling Reduces capacity during deploy
MechanicsDeploys in batches (fixed count or percentage); each batch is taken out of service, updated, then returned before the next batch starts
DowntimeNo full outage, but total fleet capacity is reduced during the deployment (fewer instances than normal are in service at any moment)
Extra costNone
RollbackManual — redeploy the previous version, also processed batch by batch
Rolling with Additional Batch Maintains full capacity
MechanicsLaunches one extra batch of new instances running the OLD version first, then performs a normal rolling update across the original fleet
DowntimeNone, and fleet capacity never drops below 100% at any point during the deployment
Extra costSmall, temporary — one extra batch of instances runs for the duration of the deployment, then is terminated
RollbackManual — redeploy the previous version
Immutable Safest in-environment option
MechanicsLaunches a brand-new, temporary Auto Scaling group with new instances running the new version, alongside the existing (old-version) fleet
DowntimeNone
Extra costTemporarily doubles compute cost — both old and new fleets run concurrently until cutover
RollbackFastest of the in-place options — if new instances fail health checks, they're simply terminated and the original fleet is untouched and never received the bad code
Traffic Splitting (Canary) Gradual, real-traffic validation
MechanicsLike Immutable, launches a new temporary fleet, but routes only a configurable percentage of live traffic to it for an evaluation period before shifting the rest
DowntimeNone
Extra costTemporarily doubles compute cost during the evaluation window, same as Immutable
RollbackFast — if error rates climb during the canary window, Beanstalk routes traffic back to the original fleet and terminates the new one

Blue/Green Deployment — Environment Swap (CNAME Swap)

Not a Deployment Policy — A Separate Workflow High-trap
MechanicsClone the application into a brand-new, fully separate Elastic Beanstalk environment (e.g. myapp-green) running the new version; test it independently via its own environment URL; then swap the CNAMEs of the two environments
DowntimeNone — the CNAME swap redirects the production domain to the new environment essentially instantly
Extra costTwo full environments run in parallel until the old one is decommissioned — the most expensive option, but only for as long as you choose to keep the old environment around as a rollback target
RollbackFastest possible — swap the CNAMEs back; the old environment was never touched
All at Once
Downtime, no extra cost
Rolling
No downtime, capacity dips
Rolling +Batch
No downtime, full capacity, small extra cost
Immutable
No downtime, double cost, fast rollback
Traffic Splitting
Gradual real-traffic canary
Blue/Green Swap
Full isolation, instant cutover, highest cost

Auto Scaling & Load Balancing Built Into an Environment

Environment Types
Single instanceNo Auto Scaling group or load balancer; one EC2 instance with an Elastic IP — cheapest, no built-in high availability
Load balanced, auto scalingFull Auto Scaling group (configurable min/max/desired capacity) fronted by an Elastic Load Balancer — the production-grade default
Worker Environment Tier
PurposeBackground/asynchronous processing, decoupled from the web-facing request/response cycle
QueuePolls an Amazon SQS queue — Beanstalk creates the queue automatically if you don't supply one, and grants the instances an IAM role with permission to read/delete messages
No load balancerWorker tier environments have no ELB — they're not receiving inbound HTTP traffic from users
Periodic tasksA cron.yaml file in the application bundle lets the worker tier run scheduled (cron-like) jobs

Health Monitoring

Basic Health Reporting
DataSimple pass/fail — instance and ELB-level status only (essentially EC2/ASG/ELB health checks)
CostNo additional cost, minimal overhead
Enhanced Health Reporting Recommended default on current platforms
DataRich OS- and application-level metrics — CPU, latency percentiles, HTTP status code histograms (2xx/3xx/4xx/5xx), causes for a degraded/severe state, per-instance detail
HowA health agent runs on each instance and reports to both the Elastic Beanstalk health dashboard and CloudWatch
EnablesHealth-based Auto Scaling — replacing instances based on application-level health, not just EC2 instance status checks

Environment health colors (see the scale at the top of the Overview tab): Green = passing, Yellow = one or more warnings (e.g. elevated latency, some instances degraded), Red = severe (majority of instances failing or application errors), Grey = insufficient data, environment is updating, or processes are suspended.

Environment Configuration & .ebextensions

What .ebextensions Is

A folder named .ebextensions at the root of your application source bundle, containing one or more YAML or JSON files (extension .config). Elastic Beanstalk applies these automatically during environment provisioning and every subsequent deployment — this is the primary, version-controlled way to customize the environment beyond what the console exposes.

.ebextensions/01_environment.config
─────────────────────────────────────
option_settings:
  aws:elasticbeanstalk:application:environment:
    NODE_ENV: production
  aws:autoscaling:asg:
    MinSize: 2
    MaxSize: 6

Resources:
  AWSEBCloudwatchAlarmHigh:
    Type: AWS::CloudWatch::Alarm
    Properties:
      MetricName: CPUUtilization
      Namespace: AWS/EC2
      Threshold: 80
      ComparisonOperator: GreaterThanThreshold

packages:
  yum:
    git: []

container_commands:
  01_migrate:
    command: "python manage.py migrate"
    leader_only: true

Environment Variables

Software Configuration Namespace
Where setConsole (Configuration → Software), EB CLI, .ebextensions option_settings under aws:elasticbeanstalk:application:environment, or a saved configuration
How accessed by appInjected into the instance/process OS environment — e.g. process.env.X in Node.js, os.environ['X'] in Python, System.getenv("X") in Java
Change behaviorUpdating an environment variable is an environment configuration change — it triggers a new deployment/instance update following your configured deployment policy, it is NOT an instant, zero-effort change

AWS Exam Thinking

Requirement → Keywords → Expected Answer → why every distractor fails. Written in the "A company needs to...", "What is the MOST appropriate solution?" style DVA-C02 actually uses.

Least operational overhead, but the team still needs SSH access to troubleshoot a traditional monolithic web app
least operational overheadSSH accessmonolithic web app
Expected Answer

AWS Elastic Beanstalk

DistractorWhy it's wrong
AWS LambdaNo server to SSH into at all — fully abstracted compute, and a poor fit for a long-running monolith
Self-managed EC2 + Auto ScalingFull SSH control, but the team must build the ASG/ELB/deployment tooling themselves — violates "least operational overhead"
Amazon ECS on EC2 (self-managed)Requires containerizing the app plus managing the cluster — more upfront work than Beanstalk for a straightforward monolith
Fleet capacity must never drop below 100% during deployment, and cost outside the deployment window must stay unchanged
capacity must not decreasetemporary extra capacity only
Expected Answer

Rolling with additional batch deployment policy

DistractorWhy it's wrong
RollingReduces total fleet capacity while each batch is out of service — fails the "never drop below 100%" requirement
ImmutableAlso maintains full capacity, but doubles the entire fleet for the whole deployment rather than adding a single extra batch — more cost/complexity than the requirement calls for
All at onceCauses a full outage — the opposite of maintaining capacity
New version must be validated within the same environment, with the fastest possible full rollback if health checks fail — a temporary doubling of compute cost is acceptable
fastest rollbacksame environmenttolerate double cost
Expected Answer

Immutable deployment policy

DistractorWhy it's wrong
Rolling with additional batchCheaper, but rollback requires a brand-new deployment of the old version — not the fastest option, and some instances briefly ran the bad code
Blue/Green environment swapAlso very fast to roll back, but requires creating and managing a whole second Elastic Beanstalk environment — the scenario specifically calls for staying within one environment
All at onceNo parallel fleet at all — if the new version fails, every instance is already broken with no immediate healthy fallback
New version must be fully validated in complete isolation via its own URL before any production traffic reaches it, then cut over instantly
full isolation before cutoverown URL for testinginstant cutover
Expected Answer

Create a second environment, test it independently, then perform an Environment Swap (CNAME swap)

DistractorWhy it's wrong
Traffic Splitting (canary)Exposes a percentage of REAL production traffic to the new version immediately — the requirement explicitly wants zero live exposure until cutover
ImmutableNew instances run inside the SAME environment/URL as production — there's no separate URL to fully validate against before cutover
RollingNo isolation at all — the new version starts serving live traffic as soon as the first batch updates
Gradually shift a percentage of live traffic to a new version and automatically roll back if error rates rise
gradual real trafficauto rollback on errors
Expected Answer

Traffic Splitting (canary) deployment policy with an Application Load Balancer

DistractorWhy it's wrong
Blue/Green environment swapAn instant, all-or-nothing cutover — not a gradual real-traffic ramp
Rolling with additional batchShifts traffic by replacing whole batches of instances, not by weighted percentage routing, and has no built-in automatic rollback on error-rate thresholds
ImmutableNew fleet only receives traffic after full cutover, not a gradually increasing percentage
Process image-processing jobs asynchronously from a queue, and let AWS manage the polling and scaling of the workers
asynchronousqueue-drivenmanaged polling
Expected Answer

Elastic Beanstalk Worker environment tier (backed by Amazon SQS)

DistractorWhy it's wrong
Web server tier with a custom cron/polling scriptWorks, but the team has to build and maintain the polling daemon themselves — Worker tier does this natively
Amazon EC2 with a custom daemonEven more undifferentiated heavy lifting than the Beanstalk answer
Amazon S3 event notification directly to the appS3 events don't apply here — the requirement is queue-driven background processing, not object-upload triggers
Install additional OS packages and provision a custom CloudWatch alarm automatically every time the environment is created or updated, without baking a custom AMI
OS packagescustom CloudWatch alarmno custom AMI
Expected Answer

An .ebextensions configuration file (packages + Resources sections)

DistractorWhy it's wrong
Build a custom AMIWorks but is heavier operational overhead and explicitly excluded by the requirement
Manually SSH into each instance and install packagesNot automated, not repeatable, and lost the moment Auto Scaling launches a new instance
A user data script onlyCan install packages, but doesn't natively integrate with Elastic Beanstalk's own CloudFormation stack the way .ebextensions Resources does for creating the alarm
Database credentials must never appear as plaintext in source-controlled configuration files
no plaintext secretssource control
Expected Answer

Store the credential in AWS Secrets Manager (or SSM Parameter Store as a SecureString) and have the application retrieve it at runtime by ARN/name

DistractorWhy it's wrong
Hardcode the password in an .ebextensions option_settings blockExactly the plaintext-in-source-control problem the requirement forbids
Hardcode the password directly in application codeSame problem, arguably worse — no rotation, no access control on the secret itself
Store it only as a console-set environment variable with no secret managerBetter than source control, but still fully visible in plaintext to anyone with read access to the environment configuration — not a true secret store with rotation/audit
Detect degraded environment health from elevated HTTP 5xx response rates and request latency, not just EC2 instance status checks
application-level health5xx ratelatency
Expected Answer

Enable Enhanced Health Reporting

DistractorWhy it's wrong
Basic health reportingOnly reports pass/fail instance and ELB status — no HTTP status code or latency visibility
AWS X-RayProvides distributed tracing/latency analysis, but isn't Elastic Beanstalk's own environment health mechanism and doesn't drive the health dashboard or health-based Auto Scaling
CloudWatch alarms on default EC2 metrics aloneDefault EC2 metrics (CPU, network) don't include HTTP status code histograms — Enhanced health reporting is what surfaces those application-level signals

Integrations & Architecture Example

Related Services

AWS CloudFormation
WhatElastic Beanstalk generates and manages a CloudFormation stack behind every environment
WhyThis is the actual provisioning/orchestration engine — you can view the generated template/stack directly for troubleshooting
Amazon EC2 / Auto Scaling / Elastic Load Balancing
WhatThe compute fleet, scaling group, and load balancer that make up a load-balanced, auto-scaling environment
WhyThese are ordinary, directly-accessible AWS resources — not a Beanstalk-proprietary compute type
Amazon RDS Classic trap
Coupled optionRDS can be created directly inside the environment via the console — simplest for dev/test
Decoupled option (recommended for production)Provision RDS separately, outside any Beanstalk environment, and connect via environment variables
Amazon S3
WhatElastic Beanstalk stores every uploaded application version in an S3 bucket it manages
WhyThis is what makes "redeploy a previous version" possible as a rollback mechanism
Amazon CloudWatch
WhatReceives environment health metrics (via Enhanced health reporting), Auto Scaling trigger metrics, and application/instance logs
WhyThe backbone for both the built-in health dashboard and any custom alarms you add via .ebextensions
IAM — Instance Profile vs Service Role Classic trap
Instance profileThe role attached to the EC2 instances themselves — grants the running application permission to call other AWS APIs (e.g. read from S3, write to DynamoDB)
Service roleThe role Elastic Beanstalk itself assumes to manage resources on your behalf (create the ASG, ELB, CloudWatch alarms, etc.) — it's Beanstalk's permission, not your application's
Amazon VPC
WhatEnvironments are launched inside a VPC — public subnets for internet-facing web tiers, private subnets for instances that shouldn't be directly reachable (e.g. behind an internal ALB, or a worker tier)
WhySame VPC security model as any other EC2-based architecture — security groups, NACLs, subnet routing all apply normally
AWS CodePipeline / CodeBuild / CodeDeploy
WhatElastic Beanstalk is a supported deploy target/action provider inside a CodePipeline stage, and the EB CLI can also be invoked directly from a CodeBuild buildspec.yml
WhyLets teams keep Beanstalk's deployment-policy safety features while still automating the full source→build→deploy workflow

See 02 — CI/CD Pipeline Services for the full pipeline mechanics.

Amazon Route 53
WhatMaps a custom domain to the environment's Beanstalk-issued CNAME (or, for advanced blue/green patterns, uses weighted routing across two environments)

End-to-End Architecture Example

CI/CD-Driven, Zero-Downtime Production Release

A team runs a Java web application on Elastic Beanstalk (Web server tier, load balanced/auto scaling, Enhanced health reporting) with its database decoupled as a standalone Amazon RDS instance. Developers push to their source repository, which triggers the following flow:

This pattern gives the team the deployment safety of Blue/Green with the automation of a full CI/CD pipeline, and keeps the database's lifecycle independent of any single environment's churn. See also 08 — Cross-Service Architectures for the "Enterprise application deployment" pattern that builds on this.

Best Practices & Common Exam Traps

When to Use Elastic Beanstalk

Use It When...
  • You have a traditional web app/API (monolith or simple service) and want AWS to manage provisioning/scaling/deployment mechanics without giving up server access
  • The team wants to SSH in, inspect logs, or apply OS-level customization via .ebextensions
  • You need built-in, safe deployment strategies (rolling/immutable/blue-green) without hand-building them
  • You want to move fast without designing a bespoke CI/CD-to-infrastructure pipeline from scratch
Consider Alternatives When...
  • The workload is a short-lived, event-driven function → Lambda removes server management entirely and bills per invocation
  • You need fine-grained control over container orchestration, multiple services sharing a cluster, or complex service-to-service networking → ECS/Fargate (or EKS) gives that control
  • You need multi-region active-active, service mesh, or very large-scale microservices → purpose-built container/serverless architectures usually fit better than one Beanstalk environment per service
Don't Use It When...
  • Your workload is a single, infrequent, short-duration task — Lambda's pay-per-invocation model is far cheaper than keeping EC2 instances running
  • You need Kubernetes-native tooling/portability across clouds — that's an EKS decision, not Beanstalk
  • You want zero infrastructure visibility/management at all — Beanstalk still exposes the underlying EC2/ASG/ELB layer, which is a feature for some teams and unwanted complexity for others

Comparison — Elastic Beanstalk vs ECS/Fargate vs Lambda

DimensionElastic BeanstalkECS / FargateLambda
Operational overheadLow — AWS provisions/manages EC2, ASG, ELB for youMedium — you design task definitions, cluster/service topology (or use Fargate to drop server management)Lowest — no servers, no cluster, no OS patching at all
Underlying infra accessFull — SSH into instances, inspect security groups/CloudFormation stack directlyPartial (EC2 launch type) to none (Fargate) — container-level access only, no host SSH on FargateNone — fully abstracted, no server concept
Scaling modelEC2 Auto Scaling group, instance-levelService-level task scaling (target tracking), Fargate scales tasks not serversAutomatic, per-request concurrency scaling
Deployment granularityWhole environment (all instances behind one ELB)Per service/task definition — supports many independently-deployed microservices per clusterPer function — independently versioned/deployed
Best forTraditional web apps/APIs needing infra control with minimal setup effortContainerized microservices needing orchestration control and portabilityEvent-driven, short-duration, spiky or infrequent workloads
Typical exam cue"least operational overhead but still need SSH/infrastructure control""containerized microservices," "need orchestration control," "portable across environments""event-driven," "pay only when code runs," "no servers to manage at all"

Common Exam Traps

MisconceptionReality
"Elastic Beanstalk is serverless"It provisions real EC2 instances, an ASG, and an ELB that you're billed for. Beanstalk itself has no service fee, but the underlying resources are ordinary, metered AWS resources
"Blue/Green is one of the deployment policy options in the environment configuration"It is not. The deployment-policy dropdown only offers All at once / Rolling / Rolling with additional batch / Immutable / Traffic Splitting. Blue/Green is a separate workflow: create a second environment, then perform an Environment Swap
"Immutable deployments are free"They temporarily double compute cost — a full parallel fleet runs until cutover
"All at once is safe enough for production because it's the default-sounding option"It causes a full outage with no fallback if the new version fails — appropriate for dev/test only
"Terminating an environment never affects the database"True only if RDS was decoupled (created outside the environment). An RDS instance created inside the environment is terminated along with it by default
"You can't customize the underlying EC2 instances in Elastic Beanstalk"You can — via .ebextensions, direct console changes, or SSH. This retained access is the core reason Beanstalk beats Lambda for scenarios needing infrastructure control
"Changing an environment variable applies instantly with zero disruption"It's a configuration change like any other — it triggers a new deployment/instance update following the environment's configured deployment policy
"leader_only: true means the command runs once per deployment on some instance"The leader is elected once, at environment creation only. New instances added later by scaling or subsequent deployments do NOT re-run leader_only commands

Memory Anchors

Hands-On Lab

Three self-contained exercises using the real EB CLI (and aws elasticbeanstalk) against eu-west-1. They turn the deployment-policy and .ebextensions theory from the other tabs into something you actually watch happen — a broken deploy under the default policy, the same break survived under Immutable, and a config file that installs a package and sets an environment variable for real. Bring your own tiny app (any of the EB-supported platforms works; examples below assume Node.js) and remember to eb terminate the environment when you're done so it doesn't keep billing.

Exercise 1 — Deploy, Watch the Health Dashboard, Then Break It (Default Policy)

  1. Confirm the EB CLI is installed, then initialize the application in eu-west-1.
    eb --version
    eb init my-eb-lab-app --platform node.js --region eu-west-1
    A local .elasticbeanstalk/config.yml is created, pinned to the eu-west-1 region and the Node.js platform.
  2. Create the environment with default settings (load balanced, All at once deployment policy).
    eb create eb-lab-env --region eu-west-1 --instance-type t3.micro
    After several minutes, the environment reports health Green in both the CLI output and the console health dashboard.
  3. Inspect the environment health dashboard directly.
    eb status
    eb health eb-lab-env
    CLI shows Health: Green, causes list is empty, and per-instance status is all "Ok" — matches what the console Health tab renders visually.
  4. Introduce a deliberate breaking change — for example, make the app listen on the wrong port or throw on startup — then redeploy without changing the deployment policy (still the default, All at once).
    # edit app.js so the server throws on boot, e.g.:
    #   throw new Error("simulated startup failure");
    
    eb deploy eb-lab-env
    The deploy reports failure; the health dashboard flips to Red/Severe across essentially the whole fleet at once, because All at once pushed the bad build to every instance simultaneously with no healthy fallback capacity.
  5. Confirm what happened via events and logs before fixing it.
    eb events eb-lab-env --follow
    eb logs eb-lab-env
    Events show the failed deployment and degraded/severe health transition; the retrieved logs contain the simulated startup error on every instance.
⚠️ Why this step matters for the exam

This is the exact mechanic behind every "All at once causes a full outage" exam line — you've now watched it happen instead of just memorizing it. Notice there was no partially-healthy fallback fleet to route around the bad build; that absence is precisely what the next exercise fixes.

Exercise 2 — Switch to Immutable, Break It Again, Compare

  1. First redeploy the known-good version to get the environment back to Green (baseline before changing policy).
    # revert the breaking change in app.js, then:
    eb deploy eb-lab-env
    Health returns to Green — you're back to a clean baseline before introducing a second variable.
  2. Add an .ebextensions config file that switches the environment's deployment policy to Immutable.
    mkdir .ebextensions
    cat > .ebextensions/01_deployment_policy.config <<'EOF'
    option_settings:
      aws:elasticbeanstalk:command:
        DeploymentPolicy: Immutable
    EOF
    
    eb deploy eb-lab-env
    The deploy succeeds and applies the configuration change; eb config eb-lab-env now shows DeploymentPolicy: Immutable instead of the default.
  3. Reintroduce the exact same breaking change from Exercise 1, then deploy again.
    # reapply the same "throw on boot" change to app.js
    eb deploy eb-lab-env
    The deploy fails, but the environment health dashboard stays Green throughout — Beanstalk launched a brand-new temporary Auto Scaling group running the bad build, watched it fail health checks, and terminated it automatically without ever routing production traffic to it. The original fleet kept serving the last good version the entire time.
  4. Confirm the rollback mechanics in the event stream.
    eb events eb-lab-env --follow
    Events show a new temporary environment/ASG being created, instances failing health checks, and an automatic rollback/termination of the temporary fleet — with no "environment health: Severe" event for the live environment itself.
  5. Redeploy the good version one more time to leave the environment clean.
    # revert app.js again, then:
    eb deploy eb-lab-env
    Health is Green again, this time still running under the Immutable policy.
⚠️ Why this step matters for the exam

Same bug, same code, two completely different production outcomes — that's the risk/speed/cost tradeoff DVA-C02 tests repeatedly. All at once was fastest to deploy but broke every instance at once; Immutable was slower to deploy (a full new fleet had to boot and pass health checks) but the bad build never touched live traffic. Also note the mechanism: it's a temporary ASG inside the same environment/CNAME, not a second environment — don't confuse this with Blue/Green.

Exercise 3 — Install a Package and Set an Environment Variable via .ebextensions

  1. Add a second .ebextensions config file that installs an OS package and sets an application environment variable in one go.
    cat > .ebextensions/02_packages_env.config <<'EOF'
    packages:
      yum:
        htop: []
    
    option_settings:
      aws:elasticbeanstalk:application:environment:
        LAB_FEATURE_FLAG: "enabled"
    EOF
    Two new keys exist under .ebextensions: an OS package to install via yum and a new environment variable, both scoped to this application bundle.
  2. Deploy the change.
    eb deploy eb-lab-env
    Deploy succeeds; because an environment variable changed, Beanstalk performs a configuration update/instance replacement following the currently configured deployment policy (Immutable, from Exercise 2) rather than an instant in-place change.
  3. Verify the package installed by SSHing into an instance.
    eb ssh eb-lab-env
    # on the instance:
    rpm -q htop
    exit
    rpm -q htop returns an installed package version instead of "package htop is not installed" — confirming the packages block ran on the instance.
  4. Verify the environment variable took effect.
    eb printenv eb-lab-env
    LAB_FEATURE_FLAG = enabled appears in the printed environment variable list, matching what process.env.LAB_FEATURE_FLAG would return inside the running application.
  5. Clean up so the lab stops billing.
    eb terminate eb-lab-env --region eu-west-1
    The environment, its Auto Scaling group, load balancer, and instances are torn down; the application and its stored versions in S3 remain unless you also delete the application itself.
⚠️ Why this step matters for the exam

This is the hands-on version of two frequently-tested traps: environment variable changes are configuration changes, not instant edits — you just watched one ride along on the currently-configured deployment policy — and .ebextensions is the version-controlled, repeatable way to install packages/set config without a custom AMI, which is exactly the "no custom AMI" exam cue from the Exam Logic tab.

Flashcards — 22 Cards

Click card to flip. Mark right or wrong to track score.

Click to reveal answer
1 / 22
Mark:   Score: 0/0

Practice Quiz — 12 Questions

DVA-C02 scenario style, Easy → Specialty. Select an answer to reveal the explanation.

out of 12 correct