Elastic Beanstalk
not serverless, underlying is EC2
Document |
Overview
Simply upload your code -> Beanstalk will do all the rest.
Underlying is EC2, including AutoScaling group.
Environment tier
Web server environment: runs a static website, a web app, or a web API that serves HTTP requests.
Worker environment: Run a worker application that processes long-running workloads on demand or performs tasks on a schedule.
one app per environment. can have multiple environments.
Feature
Simplest way to deploy & run web app
Auto scaling, load balancing
Auto health monitoring: auto collect more than 40 key metrics and attributes to determine the health of your web application in one unified interface.
Fully managed (patching...)
Complete resource control
Deployment Policies
All at once
Deploy new version to all instances. This is the default deployment option.
Rolling
Updates a few instances at a time (batch), and then moves onto the next batch once the first batch is healthy.
The impact of failed deployment is lower compared to All at once since rollbacks are applied in
batches as well.
Rolling with additional batch
Similar to Rolling, but Elastic Beanstalk launches an additional batch of instances to ensure that the full capacity is available to serve traffic during the update process.
Pros: the application always runs at full capacity.
Cons: some users may continue to see the old version.
Make sure that your EC2 limits have enough capacity for the deployment to proceed. For example, say you have a quota of 20 instances per region, and you’re already running 19. If your batch size is 2 instances, Elastic Beanstalk won’t be able to create those extra instances
Immutable
Deploys the new version to a fresh group of instances in a new Auto Scaling group. Once the new instances pass health checks, they are moved to your existing Auto Scaling group, and the old instances are terminated.
Pros: no downtime
Cons: costly and subjected to on-demand EC2 limits since capacity is doubled for a brief time. It’s also the slowest deployment method.
Traffic splitting (Blue/Green)
Deploy the new version to a fresh group of instances and temporarily split incoming client traffic between the existing application version and the new one.
Pros:
Suitable for A/B or canary testing.
If the new instances do not pass the health checks or if you decide to cancel the deployment, Elastic Beanstalk will simply reroute the traffic back to the old instances and terminate the new instances.
.ebextensions
Formatting – Configuration files must conform to YAML or JSON specifications.
Naming – Configuration files must have the
.config
file extension -> YAML or JSON format but naming is.config
.
If you use a key (for example, option_settings
) twice in the same configuration file, one of the sections will be dropped.
Pricing
No additional charge for ElasticBeanstalk. You need to pay for S3 (store codes) & EC2.
Best practices
Trivia
Anything in the
.ebextensions
folder will be run as part of your Elastic Beanstalk environment creation.
Last updated