3.4.4 Manage Application Environments

Manage Application Environments by Using AWS Services

Elastic Beanstalk

eb create my-app-dev --envvars STAGE=dev
eb create my-app-prod --envvars STAGE=prod
eb deploy my-app-dev
  • Environment cloning
  • Swap environment URLs (blue/green)
  • .ebextensions/ for config

ECS Services

Cluster: my-cluster
  Service: my-app-dev  → Task Def v3
  Service: my-app-prod → Task Def v2

Copilot

copilot env init --name test
copilot env init --name prod
copilot svc deploy --env test
copilot svc deploy --env prod

CloudFormation Parameters

Parameters:
  Stage:
    Type: String
    AllowedValues: [dev, staging, prod]

Conditions:
  IsProd: !Equals [!Ref Stage, prod]

Exam Tip: Beanstalk = managed environments. ECS = container environments. Copilot = simplified ECS. CloudFormation Parameters + Conditions for env-specific resources.