Elastic Beanstalk
Difficulty: medium
Overview
AWS Elastic Beanstalk is a PaaS that handles infrastructure, deployment, load balancing, and auto scaling.
Environment Types:
- Web Server: ALB + EC2 + ASG.
- Worker: SQS + EC2 + daemon. Long-running tasks. cron.yaml for scheduling.
Deployment Policies:
| Policy | Downtime | Extra Cost |
|---|---|---|
| All at Once | Yes | No |
| Rolling | No | No |
| Rolling with additional batch | No | Yes (temp) |
| Immutable | No | Yes (double) |
| Traffic splitting (Canary) | No | Yes (temp) |
| Blue/Green | No | Yes (double env) |
Blue/Green: Create separate environment → deploy → Swap Environment URLs → instant switch. Rollback: swap back.
.ebextensions: YAML/JSON config files in .ebextensions/ directory. Install packages, run commands, configure environment. Processed alphabetically.
Managed Platform Updates: Automatic OS/runtime patches in a maintenance window.
Practice Linked Questions
Q1. A developer deploys a web app on AWS Elastic Beanstalk. They want to deploy a new version with zero downtime, while keeping the same number of instances running. Which deployment policy should they choose?
Select one answer before revealing.
Q2. A developer uses Elastic Beanstalk and needs to run a custom script to install a library on EC2 instances before the application starts. Where should this script be placed?
Select one answer before revealing.
Q3. After deploying a new Elastic Beanstalk application version, a developer discovers a critical bug. They need to immediately restore the previous working version. What should the developer do?
Select one answer before revealing.