Elastic Beanstalk Flashcards
What is Elastic Beanstalk?
Is a managed platform as a service (PAAS) and a developer-centric view of managing End-to-end web applications on AWS.
Who is in full control over the configuration of Elastic Beanstalk?
You, not AWS
Is Elastic Beanstalk free?
yes, but you pay for the underlying instances
How is the deployment strategy of Elastic Beanstalk?
configurable but performed by Elastic Beanstalk
What are the 3 architecture models of Elastic Beanstalk?
- Single instance
- LB + ASG
- ASG only
What is good for Single instance architecture model of Elastic Beanstalk?
good for dev
What is good for LB + ASG architecture model of Elastic Beanstalk?
good for prod or pre-prod web apps
What is good for ASG only architecture model of Elastic Beanstalk?
for non-web apps in prod (workers, etc…)
What are the 3 components of Elastic Beanstalk?
- Application
- Application version: each deployment gets assigned a version
- Environment name (dev, test, prod…): free naming
Can you rollback to an old application version in Elastic Beanstalk?
yes
Is there a lifecycle of environments in Elastic Beanstalk?
yes, and you can fully control it
What technologies are supported by Elastic Beanstalk?
- Many programming languages
- Docker containers
- your custom written platform (advanced)
What is just the responsability of the developer in Elastic Beanstalk?
the code
Once you create your app in Elastic Beanstalk, what is created along with it?
- an environment
- a new application version
- all the underlying elements of your application i.e. S3 buckets, Security Groups, EC2 instances, EIPs, etc.
What is the Beanstalk Application code options?
upload your code as a zip or create a sample application
What is the main information provided in the Beanstalk environment?
- Configuration
- Logs
- Health
- Monitoring
- Alarms
- Events
What shows you what is going on in your Beanstalk environment?
The Events. There are several severity levels: o TRACE o DEBUG o INFO o WARN o ERROR o FATAL
What is available to you when you create a second Beanstalk environment?
To create a worker environment
What are the 5 configuration presets in Beanstalk apps?
o Single instance (free tier) o Single instance (using Spot instance) o High Availability o High Availability (using on demand and spot instances) o Custom configuration
What are the main aspects included in the Beanstalk App configuration?
- Presets
- Software (X-Ray, S3 log storage, CloudWatch logs, etc.)
- Instances (Root volume, Security groups, etc.)
- Capacity
- Rolling updates and deployments
- Security
- Monitoring
- Managed Updates
- Notifications
- Network
- Database
- Tags
What you should know about RDS databases in Beanstalk applications?
DS can be provisioned with Beanstalk, which is great for dev / test
• This is not great for prod as the database lifecycle is tied to the Beanstalk environment lifecycle and it is deleted with the environment
• The best for prod is to separately create an RDS database and provide our EB application with the connection string
What are the 4 Beanstalk Deployment options for updates?
- All at once
- Rolling
- Rolling with additional batches
- Immutable
What are the no cost Beanstalk Deployment options for updates?
- All at once
- Rolling
What Beanstalk Deployment option for updates has downtime?
All at once
What Beanstalk Deployment option for updates has the higher cost?
Immutable, double capacity
What is the order of Beanstalk Deployment options for updates in terms of deployment speed?
fastest to slowest:
- All at once
- Rolling
- Rolling with additional batches
- Immutable
What is great for Beanstalk Deployment option for updates All at once?
for quick iterations in development environment
How does work Beanstalk Deployment option for updates All at once?
deploy all in one go
How does work Beanstalk Deployment option for updates Rolling?
update a few instances at a time (bucket), and then move onto the next bucket once the first bucket is healthy
How does work Beanstalk Deployment option for updates Rolling with additional batches?
like rolling, but spins up new instances to move the batch (so that the old application is still available)
How does work Beanstalk Deployment option for updates Immutable?
spins up new instances in a new ASG, deploys version to these instances, and then swaps all the instances when everything is healthy
How can you define Beanstalk Deployment options for updates buckets/batches?
Bucket / Batch size can be a total of instances or a % of instances
What Beanstalk Deployment options for updates allow to use buckets/batches?
- rolling
- rolling with additional batches
What Beanstalk Deployment option for updates keeps your application running but at bellow capacity?
rolling
What Beanstalk Deployment option for updates keeps your application running at capacity?
Rolling with additional batches
Immutable
What Beanstalk Deployment options for updates are good for prod environments?
- rolling with additional batches
- Immutable (GREAT)
What allows you to create a new “stage” environment and deploy v2 there to be validated in Beanstalk?
Blue / Green deployment
What is the new environment color in Blue / Green deployment?
Green
How could you test your new green environment?
Route 53 can be setup using weighted policies to redirect a little bit of traffic to the stage environment
Using Beanstalk what you need to do once the Green environment has been validated?
A CNAME URLs swap
What can you install to work with Beanstalk from the CLI easier?
We can install an additional CLI called the “EB cli” which makes working with Beanstalk from the CLI easier.
What is helpful for the EB CLI?
It’s helpful for your automated deployment pipelines!
How many application versions can store at most Elastic Beanstalk ?
Elastic Beanstalk can store at most 1000 application versions
What can you use to phase out old application versions in Beanstalk?
To phase out old application versions, use a lifecycle policy
Based on what can you define lifecycle policies in Beanstalk?
o Based on time (old versions are removed)
o Based on quantity, space (when you have too many versions)
What happens to versions that are currently in use and are affected by a Beanstalk lifecycle policy?
Versions that are currently used won’t be deleted
What happens to the source bundles in S3 of versions that are affected by a Beanstalk lifecycle policy?
You have the option to retain or delete the source bundle in S3 to prevent data loss (useful for restoring purposes)
How can you configure your Beanstalk apps outside the console?
All the parameters set in the UI can be configured with code using files
Where should be located the code where you are configuring your Beanstalk app?
in the .ebextensions/ directory in the root of source code
What format must have the code where you are configuring your Beanstalk app?
YAML / JSON format
What file extension must have the file where you are configuring your Beanstalk app?
.config extensions (example: logging.config)
What are you able to do from the code where you are configuring your Beanstalk app?
o Able to modify some default settings using: option_settings
o Ability to add resources such as RDS, ElastiCache, DynamoDB, etc.…
What could happen to resources managed by .ebextensions from the code where you are configuring your Beanstalk app?
Resources managed by .ebextensions get deleted if the environment goes away
Set an example of one option_settings that you can modify from the code where you are configuring your Beanstalk app
Environment variables
What relies on Beanstalk under the hood?
Under the hood, Elastic Beanstalk relies on CloudFormation. Stacks are created behind scenes
What can you do in your .ebextensions using CloudFormation?
you can define CloudFormation resources in your .ebextensions to provision ElastiCache, an S3 bucket, anything you want!
What is useful for deploying a “test” version of your Beanstalk application?
Cloning feature
While cloning a Beanstalk environment, what can and cannot you change?
While cloning an environment, you can just change a few settings, you can’t change i.e. the LB
While cloning a Beanstalk environment, what happens to RDS?
You can clone RDS database type but the data is not preserved
How can you migrate your ELB in Beanstalk?
After creating an ELB, you cannot change the type. To migrate:
o create a new environment with the same configuration except LB (can’t clone)
o deploy your application onto the new environment
o perform a CNAME swap or Route53 update
How can you decouple your RDS database from your Beanstalk environment?
- Create a snapshot of RDS DB (as a safeguard)
- Go to the RDS console and protect the RDS database from deletion
- Create a new Elastic Beanstalk environment, without RDS, point your application to existing RDS
- perform a CNAME swap (blue/green) or Route 53 update, confirm working
- Terminate the old environment (RDS won’t be deleted)
- Delete manually CloudFormation stack (in DELETE_FAILED state)
What you must provide to run a Elastic Beanstalk – Single Container Docker?
Either:
o Dockerfile: Elastic Beanstalk will build and run the Docker container
o Dockerrun.aws.json (v1): Describe where already built Docker image is
What Beanstalk platform does not use ECS?
Beanstalk in Single Docker Container does not use ECS
What is required to run a Beanstalk Multicontainer Docker?
- a config Dockerrun.aws.json (v2) at the root of source code
- Dockerrun.aws.json is used to generate the ECS task definition
- Your Docker images must be pre-built and stored in ECR for example
What is used for a Beanstalk Multi container Docker?
• Multi Docker helps run multiple containers per EC2 instance in EB
• This will create for you:
o ECS Cluster
o EC2 instances, configured to use the ECS Cluster
o Load Balancer (in high availability mode)
o Task definitions and execution
What can you do if your Beanstalk application performs tasks that are long to complete?
decouple your app in two tiers and offload these tasks to a dedicated worker environment
How can you define tasks in your Beanstalk worker environment?
You can define periodic tasks in a file cron.yaml
How can you create a new Beanstalk platform?
Build that platform using the Packer software (open source tool to create AMIs)
What is the use case for creating a new Beanstalk platform?
Use case: app language is incompatible with Beanstalk & doesn’t use Docker