Beanstalk Flashcards
What is Beanstalk?
A developer centric view of deploying an application on AWS that uses ec2, asg, alb
What is the responsibility of the developer for beanstalk?
Just the application code
What are the three architecture models:
Single instance deployment: good for dev, LB+ ASG: freat for production or pre-production web applications, ASG only: great for non-web apps in production
Model for Elastic Beanstalk
Create application -> create environment -> upload version -> release to environment
Beanstalk deployment options for updates
All at once (deploy all in one go) - fast, but instances aren’t available to serve traffic for a bit (downtime).
Rolling: update a few instances at a time(bucket), and then move onto the next bucket once the first bucket is healthy
Rolling w/ additional batches: like rolling, but spins up new instances to move the batch (so that the old application is still available).
Immutable: spins up new instances in a new ASG, deploys versions to these instances, and then swaps all the instances when everything is healthy
Blue/Green deployment
Zero downtime, original environment is blue, new environment green can be validated independently and rolled back. Weighted policy to direct to blue and green.
Beanstalk deployment process
Describe dependencies, package code as zip, upload zip file and then deploy. Beanstalk will then deploy the zip on each ec2 instance, resolve dependencies and start the application
Beanstalk lifecycle policy
Beanstalk can store at most 1000 app versions. If you don’t remove old versions you won’t be able to deploy anymore.
- Use lifecycle policy based on time or space (too many versions).
- You have the option not to delete the source bundle in S3 to prevent data loss
How to add Beanstalk extensions
.config file within .ebxentions folder, yaml/JSON format, allows you to add resources such as RDS, Elasticache, Dynamodb.
If the Beanstalk environment goes away, what gets deleted
resources managed by .ebextentions.
After creating an environment, can you change the ELB type?
No, you need to create a new environment (cannot clone it), and then deploy your application on the new environment and perform a CNAME swap of the Route 53 update.
How do you provision RDS with beanstalk?
It is not great for production since the DB lifecycle is tied to the beanstalk environment lifecycle, so the best way is to create a snapshot of rds db, and point your app (by creating a new environment) to the existing RDS), then perform a CNAM swap, terminate old environment, and delete cloudformation swap
How to run a single docker on beanstalk
Provide a dockerfile or dockerrun.aws.json. Do not use ECS.
How to run a multi docker container
Requires a config dockerrunaws.json at the route of the source code.
How to run beanstalk and HTTPS
Load the SSL certificate on the load balancer, or from alb.config or . ebextensions. Must also configure security group rule to allow incoming port 443.