Deploy to Elastic Beanstalk
Deploy application code, manage versions, rollback, and configure deployment strategies using the EB CLI.
When to Use
- Deploy code to an environment
- Rollback to a previous version
- Configure deployment strategies (rolling, immutable, etc.)
- Create application versions without deploying
- Set up CI/CD integration
- Configure
.ebignore - Configure CodeCommit as deploy source
- Test Docker app locally before deploying
When NOT to Use
- Creating new environments → use
environmentskill - Checking status after deploy → use
statusskill - Viewing deployment logs → use
logsskill - Changing configuration settings → use
configskill
Pre-Deploy Checklist
eb status # Verify environment is Ready
eb health # Verify health is Green
If health is Red or environment is Updating, do NOT deploy. Fix issues first.
Quick Deploy
eb deploy
Deploy to specific environment:
eb deploy <env-name>
Deploy with Version Label
eb deploy --label "v1.2.3"
eb deploy --label "v1.2.3" --message "Release v1.2.3 - Bug fixes"
Deploy Staged Changes Only
eb deploy --staged
Deploy Existing Version
eb deploy --version <version-label>
Create Version Without Deploying
eb deploy --process
Monitor Deployment
eb events --follow
Post-Deploy Verification
eb status # Confirm version deployed
eb health # Confirm health is Green
eb events # Check for warnings
eb open # Open in browser
Look for:
- "New application version was deployed" — success
- "Environment health has transitioned from Ok to ..." — health degradation
- "Rolling back to version" — automatic rollback triggered
Rollback
# List available versions
eb appversion
# Deploy previous known-good version
eb deploy --version <previous-version>
# Verify rollback
eb status
eb health
Deployment Strategies
- AllAtOnce (Default) — Fastest, causes downtime
- Rolling — Updates in batches, maintains capacity
- RollingWithAdditionalBatch — Maintains full capacity
- Immutable — Safest, deploys to new instances
- TrafficSplitting — Canary deployments
- Blue/Green — CNAME swap (see
environmentskill)
Configure via eb config:
aws:elasticbeanstalk:command:
DeploymentPolicy: Rolling
BatchSize: '30'
BatchSizeType: Percentage
.ebignore File
node_modules/
.venv/
__pycache__/
dist/
build/
.env
.env.local
.idea/
.vscode/
.git/
Code Source (CodeCommit Integration)
eb codesource # Choose between CodeCommit and local
eb codesource codecommit # Enable CodeCommit integration
eb codesource local # Disable CodeCommit, use local source
Note: CodeCommit integration is not available in all AWS Regions.
Local Testing (Docker)
Test Docker-based apps locally before deploying. Requires Docker installed. Linux/macOS only.
eb local run # Run containers locally
eb local run --port 8080 # Map to specific host port
eb local status # Check local container status
eb local open # Open in browser
eb local logs # Show log file locations
eb local setenv KEY=value # Set local env vars
eb local printenv # View local env vars
CI/CD Integration
eb deploy --nohang # Non-interactive deploy
eb status --wait # Wait for completion
eb health # Verify healthy
Composability
- Check status after deploy: Use
statusskill - View deployment logs: Use
logsskill - Change deployment config: Use
configskill - Create new environment: Use
environmentskill - Manage app versions: Use
appskill
Additional Resources
Converted and distributed by TomeVault — claim your Tome and manage your conversions.