Environment Management
Create, terminate, clone, swap, abort, and restore Elastic Beanstalk environments using the EB CLI.
When to Use
- Create a new environment
- Terminate an environment
- Clone an environment
- Swap URLs (blue/green deployment)
- Abort an in-progress update
- Restore a terminated environment
- Check DNS availability for CNAME
When NOT to Use
- Deploying to an existing environment → use
deployskill - Changing configuration → use
configskill - Checking status → use
statusskill - Platform updates → use
maintenanceskill
Destructive Operations Warning
Before terminate/restore: verify environment name, check traffic, confirm with user.
Solution Stack Validation
Before creating, verify the platform solution stack name:
aws elasticbeanstalk list-available-solution-stacks --output json --query 'SolutionStacks'
Solution stack name format (example — version will vary, always query for latest):
64bit Amazon Linux 2023 v<version> running Node.js <node-version>
Create Environment
eb create <env-name>
eb create <env-name> --instance_type t3.medium
eb create <env-name> --elb-type application
eb create <env-name> --single # No load balancer
eb create <env-name> --scale 2
eb create <env-name> --envvars KEY1=val1,KEY2=val2
eb create <env-name> --tags Env=production
eb create <env-name> --cname <prefix>
eb create <env-name> --tier worker
DNS Availability Check (before create with custom CNAME)
aws elasticbeanstalk check-dns-availability \
--cname-prefix <desired-prefix> --output json
Terminate
eb terminate <env-name>
eb terminate <env-name> --force
Clone
eb clone <source-env> --clone_name <new-env>
Swap URLs (Blue/Green)
eb swap <env1> --destination_name <env2>
Abort In-Progress Update
eb abort
Restore Terminated Environment
eb restore --list
eb restore <env-id>
Composability
- Deploy to new environment: Use
deployskill - Configure new environment: Use
configskill - Check environment status: Use
statusskill - Platform migration: Use
maintenanceskill
Additional Resources
Converted and distributed by TomeVault — claim your Tome and manage your conversions.