AWS Elastic Beanstalk
What service does Elastic Beanstalk use under the hood?
AWS cloudFromation
I would like to update my development environment as soon as a new version is available. Because my Elastic Beanstalk environment is internal and only used by me, I don't mind downtime. Which deployment options is the best fit?
All at once
When to use custom platforms?
If application language is incompatible with Beanstalk & doesn't use Docker.then use custom platform.
Elastic Beanstalk Cloning
It is allowing you to clone an existing environment into a new environment and it will have the exact same configuration. Which is extremely helpful if you already have a projection version of your application and you want to deploy a test version with the exact same settings.
AWS Elastic Beanstalk
It is an easy-to-use service for deploying and scaling web applications and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker on familiar servers such as Apache, Nginx, Passenger, and IIS. --> Browse log files, monitor app health, adjust auto-scaling rules, setup email notifications
Custom Platform
It is to create an entirely new Beanstalk Platform and allow to define from scratch: • The Operating System (OS) • Additional Software • Scripts that Beanstalk runs on these platforms
Developer's Responsibilities on elastic beanstalk
Just the application code is the responsibility of the developer
You are looking to perform a set of repetitive and scheduled tasks asynchronously. Which Elastic Beanstalk environment should you setup?
Setup a Worker environment and a cron.yaml file
I am creating an application and would like for it to be running with minimal cost in a development environment. I should run it in
Single Instance mode
What language are supported by Elastic Beanstalk?
Support for many platforms: • Go • Java SE • Java with Tomcat • .NET on Windows Server with IIS • Node.js • PHP • Python • Ruby • Packer Builder • Single Container Docker • Multicontainer Docker • Preconfigured Docker If not supported, you can write your custom platform (advanced)
CloudFormation
With this you can deploy Elasticache, or DynamoDB, or S3 buckets. And so that would allow us to expand our Elastic Beanstalk applications to include anything we wanted.
Can we changes settings after cloning our environment?
Yes
Environments in Elastic Beanstalk
can be named freely
RDS with Elastic Beanstalk is great option for ....?
development/ test only (but the best for prod is to separately create an RDS database and provide our EB application with the connection string)
Beanstalk lifecycle policy
is used to phase out old application versions. • Based on time (old versions are removed) • Based on space (when you have too many versions) Note: • Versions that are currently used won't be deleted • Option not to delete the source bundle in S3 to prevent data loss
custom AMI
it allows you to tweak an existing Beanstalk platform, so you can tweak Python, tweak Node.js, tweak Java,
Application versions can be deployed to
many environments
I would like to customize the runtime of Elastic Beanstalk and include some of my company wide security software. I should
provide a custom platform
Different kind of deployments
• All at once (deploy all in one go) - fastest, but instances aren't available to serve traffic for a bit (you'll get downtime) • Rolling: update a few instances at a time (bucket), and then move onto the next bucket once the first bucket is healthy • Rolling with 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 version to these instances, and then swaps all the instances when everything is healthy
where all the configuration files in beanstalk must be stored?
All configuration files must be in the .ebextensions/ directory in the root of your source code i.e. .ebextensions/.
Elastic Beanstalk Deployment Modes
1) Single Instance (Great for development) 2) High Availability with Load Balancer (Great for production)
You would like your Elastic Beanstalk environment to expose an HTTPS endpoint instead of an HTTP endpoint in order to get in-flight encryption between your clients and your web servers. What must be done to setup HTTPS on Beanstalk?
Create an .ebextension/elb.config file to configure the Load Balancer
I would like to create an ElastiCache with my Elastic Beanstalk environment. I should
Create an elasticache.config file in the .ebextensions folder which is at the root of the code zip file and provide appropriate configuration
Elastic Beanstalk Deployment Process
• Describe dependencies (requirements.txt for Python, package.json for Node.js) • Package code as zip, and describe dependencies • Python: requirements.txt • Node.js: package.json • Console: upload zip file (creates new app version), and then deploy • CLI: create new app version using CLI (uploads zip), and then deploy
Developer problems on AWS
• Managing infrastructure • Deploying Code • Configuring all the databases, load balancers, etc • Scaling concerns
Multi Docker Container
• Multi Docker helps run multiple containers per EC2 instance in EB • This will create for you: • ECS Cluster • EC2 instances, configured to use the ECS Cluster • Load Balancer (in high availability mode) • Task definitions and execution • Requires a config Dockerrun.aws.json (v2) at the root of source code • Dockerrun.aws.json is used to generate the ECS task definition
Elastic Beanstalk Extensions
• Requirements: • in the .ebextensions/ directory in the root of source code • YAML / JSON format • .config extensions (example: logging.config) • Able to modify some default settings using: option_settings • Ability to add resources such as RDS, ElastiCache, DynamoDB, etc...
Three architecture models on Beanstalk
• Single Instance deployment: good for dev • LB + ASG: great for production or pre-production web applications • ASG only: great for non-web apps in production (workers, etc..)
What you have to do if you want to change load balancer type after creating an Elastic Beanstalk environment ?
Elastic Beanstalk Migration
how many application versions Elastic Beanstalk can store ?
Elastic Beanstalk can store at most 1000 application versions
I would like to update my Elastic Beanstalk application so that we are able to roll back very quickly in case of issues with the new application version. Which deployment mode is the best fit?
Immutable. (o roll back quickly, this deployment mode terminates the temporary ASG that has the new version, while the current one is untouched and already running at capacity)
You have created a test environment in Elastic Beanstalk and as part of that environment, you have created an RDS database. How can you make sure the database can be explored after the environment is destroyed?
Make a snapshot of the database before it gets deleted
Does Beanstalk in Single Docker Container use ECS?
No
Can we change the load balancer later on during lifecycle of your environment?
No, you can not change the load balancer later on. So if you choose Application Load Balancer, you have to keep an application load balancer for your entire lifecycle of your environment.
My deployments on Elastic Beanstalk have been painfully slow, and after looking at the logs, I realize this is due to the fact that my dependencies are resolved on each EC2 machine at deployment time. How can I speed up my deployment with the minimal impact?
Resolve the dependencies beforehand and package them in the zip file uploaded to Elastic Beanstalk
I want to update my Elastic Beanstalk application gradually without incurring new costs on update. My application has been over provisioned and can temporarily decrease in size for the number of serving instances, but I still want to serve my users without downtime. I do not want to incur extra costs over updates. Which deployment mode is the best fit?
Rolling
We would like to update our EB application with minimal added cost, while maintaining the full capacity to serve our current users in production. Which deployment is the best fit?
Rolling with additional batches
components of Elastic Beanstalk
three components • Application • Application version: each deployment gets assigned a version • Environment name (dev, test, prod...): free naming