Elastic Beanstalk Flashcards
Describe the All at once deployment process, stating where it would be useful.
All instances are stopped, then we deploy the new instances.
- Fastest deployment
- Application has downtime
- Great for quick iterations in dev env.
- No additional cost
Describe the Rolling deployment.
Instances are stopped and then updated as per the predefined bucket size - e.g., 4 of v1 -> 2 of v1, 2 of v2 -> 4 of v2 (with downtime/decreased instance numbers)
- Application is running both versions at the same time
- No additional cost (instance count is never higher than max)
- Long deployment
Describe the Rolling with additional batches deployment.
Same as Rolling, except a new batch of instances are deployed alongside the old ones are, and are kept while the old ones are stopped and updated (e.g., 4 of v1 -> 4 of v1, 2 of v2 -> 2 of v1, 4 of v2 -> 6 of v2 -> 4 of v2)
Describe the Immutable deployment.
- Zero downtime
- New code is deployed to new instances on a temporary ASG
- New instances are then merged to the current ASG, and the old instances are then terminated
- High cost, double capacity
- Longest deployment
- Quick rollback in case of failures (terminate new ASG)
Describe Blue / Green deployment
Not a ‘direct feature’ of Beanstalk
- Zero downtime and release facility
- Create a new ‘stage’ environment and deploy v2 in there
- New env. can be validated independently and rolled back if issues
- Route 53 can be setup with weighted policies to redirect some traffic to the stage env.
- Using Beanstalk, ‘swap URLs’ when done with the env. test
What is the limit on the number of application versions Beanstalk can store, and how should you avoid hitting that limit?
1000 application versions
- Use a lifecycle policy to remove old versions (based on age of version or just total version count)
- Active versions will not be deleted
How would you avoid data loss when using a lifecycle policy to delete old Beanstalk application versions?
Select the option not to delete the source bundle in S3
How can you set Beanstalk configuration using files? What must you be careful of when using these files?
- Create your .config file in the .ebextensions/ directory in the root of source code
- YAML / JSON format
- Can modify some default settings and add other AWS resources
- Resources managed by .ebextensions get deleted if the environment goes away
What does Beanstalk use to create all its resources? What is a use case for knowing this?
It uses CloudFormation to provision other AWS services
- You can define CloudFormation resources in you .ebextensions to provision ElastiCache, and S3 bucket etc.
If you wanted to deploy a ‘test’ version of your application, what can you do?
Clone the environment, keeping the same configuration.
How can you change your Beanstalk Load Balancer to another type of Load Balancer?
- Cannot change the balancer type in an environment once it has been chosen
Migrate to a new configuration: - Create a new env with the same configuration except the load balancer (therefore cannot just clone)
- Deploy your application onto the new environment
- Perform a CNAME swap or Route 53 update
What is the issue with provisioning RDS with Beanstalk?
Database lifecycle is tied to the Beanstalk env lifecycle.
How should you manage RDS with Beanstalk for prod env?
Separately create an RDS database and provide EB application with connection string.
How do you decouple the RDS that has already been couple to a Beanstalk env?
- Snapshot the DB as a safeguard
- Go to RDS console and protect the RDS database from deletion
- Create a new Beanstalk env without RDS, and point the application to the existing RDS
- Perform a CNAME swap or Route 53 update
- Terminate old env (RDS won’t be deleted due to protection)
- Delete the CloudFormation stack for the old env (which will be stuck in the DELETE_FAILED state)
How would you run your application as a single docker container?
Provide either:
- Dockerfile: Beanstalk will build and run the Docker container
- Dockerrun.aws.json (v1): Describe where already built Docker image is