Section 17: AWS Elastic Beanstalk Flashcards
T/F
This is the AWS glossary definition of elastic beanstalk: “ A logical collection of components, including environments, versions, and environment configurations. An application is conceptually similar to a folder.”
True
T/F
Why does AWS say you should use Elastic Beanstalk?
Elastic Beanstalk is a service for deploying and scaling web applications and services. Upload your code and Elastic Beanstalk automatically handles the deployment—from capacity provisioning, load balancing, and auto scaling to application health monitoring.
https://aws.amazon.com/elasticbeanstalk/?gclid=Cj0KCQiAy9msBhD0ARIsANbk0A8uXIbD3ikLDdtBenk6sClW-TOLPLGb9daCWkNmLRru_2cPdd4UKdwaApYQEALw_wcB&trk=b1c3dd7d-1b94-4b82-99e3-c1505e3a55fb&sc_channel=ps&ef_id=Cj0KCQiAy9msBhD0ARIsANbk0A8uXIbD3ikLDdtBenk6sClW-TOLPLGb9daCWkNmLRru_2cPdd4UKdwaApYQEALw_wcB:G:s&s_kwcid=AL!4422!3!651737511569!e!!g!!elastic%20beanstalk!19845796021!146736269029
elastic beanstalk automatically handles the what (number of things) so developers can do what?
- elastic beanstalk automatically handles the capacity provisioning, load balancing, scaling, application health monitoring, instance configuration etc
- so developers can focus on just the application code
When using elastic beanstalk, does the developer still have full control over the configuration?
yes
Does beanstalk cost money?
No, but you pay for the underlying instances (any ec2s, albs, elbs, rds’s etc)
What aws services does beanstalk use? (Languages and four specific services)
” Elastic Beanstalk is ideal if you have a PHP, Java, Python, Ruby, Node.js, .NET, Go, or Docker web application. Elastic Beanstalk uses core AWS services such as Amazon Elastic Compute Cloud (EC2), Amazon Elastic Container Service (ECS), AWS Auto Scaling, and Elastic Load Balancing (ELB) to easily support applications that need to scale to serve millions of users.”
https://aws.amazon.com/elasticbeanstalk/details/#:~:text=js%2C%20.,to%20serve%20millions%20of%20users.
- name some of the supported platforms for elastic beanstalk.
- What happens if the platform you want is not supported?
- full list: Go, Java SE, Java with Tomcat, .NET Core on Linux, .NET in WIndows, Node.js, PHP, Python, Ruby, Packer Builder, Single Container Docker, Multi Container Docker, Preconfigured Docker.
- If the platform you want is not supported yiou can write your own custom platform.
What is an environment tier in elastic beanstalk? What are the two options?
“Environment tiers designate the type of application that the environment runs, and determines what resources Elastic Beanstalk provisions to support it.” The two options are web server environment tier (for serving http requests) and worker environment tier (for pulling tasks from an Amazon Simple Queue Service queue).
If you have an application that serves HTTP requests, which elastic beanstalk environment tier should you use?
You should use a web server environment tier.
If you have a backend environment (i think app might make more sense to me) that pulls tasks from an Amazon Simple Queue Service (Amazon SQS) queue uses what kind of Elastic Beanstalk environment tier?
Worker environment tier
How many deployment options are there for beanstalk, and what are they? (just names, we’ll cover definitions later)
6 options: all at once, rolling, rolling with additional batches, immutable, blue green, traffic splitting
What is beanstalk deployment option “all at once”. Does it incur an additional cost?
Deploy all instances in one go. It’s the fastest of the dpeloyment options, but the instances aren’t available to serve traffic for a bit (guess it’s still the fastest?). no a
- What is beanstalk deployment option “rolling”. Describe it in terms of what happens if you have four buckets of application version 1 and want to implement application version 2.
- Does it incur an additional cost?
- Is it a slow or fast overall deployment process?
update a few instances at a time (bucket, whatever that means) and then move onto the next bucket once the first bucket is healthy.
- If you have four buckets of version 1, two might get removed. after that two buckets of version 2 get added. Then the final two buckets of version one get removed, then the final two buckets of version two get added. Now you have four buckets of version two. This means that for a time, your app is running below capacity. Then after that, for ahile your application is running both versions simultaneously. You can choose the bucket size
- It incurs no additional cost.
- Slow.
- What is beanstalk deployment option “rolling with additional batches”. Describe what happens if you have four applications of version 1 running and you want them to become application version 2s.
- Does it incur an additional cost?
- Slower or longer deployment?
- like rolling, but it spins up new instances to move the batch (so that the old app is still available).
Application is always running at capacity. If you have four v1s, two v2s get added. When they’re ready, two of the v1s get removed. Then after that, two more v2s get added. Then when those are ready, the last two v1s get removed. Now you have no v1s and four v2s. You can set the bucket size. so I suppose you could have determined how many buckets to add/remove each time. - incurs small additional cost
- longer deployment
- What is beanstalk deployment option “immutable” . How does it work if you have four v1s and you want four application version 2s.
- Does it incur an additional cost?
- Slower or longer deployment?
- spins up new instances in a new, temporary ASG. Then deploys the v2s in the new ASG.Then when the new instances are ready, the new instances get moved to the first ASG. Then the v1 instances are terminated.
- high cost, double capacity
- longest deployment
- great for prod, since there is zero downtime and quick rollback in case of failures.
- what is beanstalk option “blue green”. What happens if you have four application v1s and you want four application v2s?
- Does it incur an additional cost?
think of your v1 environment as environment blue. Then an environment green gets created for v2. When the v2 instances are ready, route 53 can be setup using weighted policies (to do something like 10% of traffic to the green v2 instance having environment). Then using beanstalk you swap URLS when done with the environment test. No DNS change.
create a new environment and switch over when ready
- What is beanstalk environment “traffic splitting”?
- Is there application downtime?
- Does it incur an additional cost?
- Traffic-splitting deployments allow you to perform canary testing. You direct some incoming client traffic to your new application version to verify the application’s health before committing to the new version and directing all traffic to it.
- there is no application downtime.
- It’s not mentioned.
- Long version: During a traffic-splitting deployment, Elastic Beanstalk creates a new set of instances in a separate temporary Auto Scaling group. Elastic Beanstalk then instructs the load balancer to direct a certain percentage of your environment’s incoming traffic to the new instances. Then, for a configured amount of time, Elastic Beanstalk tracks the health of the new set of instances. If all is well, Elastic Beanstalk shifts remaining traffic to the new instances and attaches them to the environment’s original Auto Scaling group, replacing the old instances. Then Elastic Beanstalk cleans up—terminates the old instances and removes the temporary Auto Scaling group.
Note
- Which of the deployment options was mentioned as best for prod?
- Which was mentioned as best for dev?
- Which is the only one that requires swapping a url?
- for prod: immutable.
- for dev: all at once.
- blue/green
Beanstalk cli basic commands are:
- eb create
- eb status
- eb health
- eb events
- eb logs
- eb open
- eb deploy
- eb config
- eb terminate
The Scold c.
it’s helpful for automated deploymennt pipelines!
beanstalk deployment process:
- describe dependencies (requirements.txt for python, package.json for Node.js etc)
- package code as zip, and describe dependencies (python requirements.txt, node.js package.json yes I know it just said that)
- console: upload zip file (creates new app version) and then deploy. alternatively, use the CLI to create the new app version (uploads zip) and then deploy
- elastic beanstalk will deploy the zip on each ec2 instance, resolve dependencies and start the application
elastic beanstalk lifecycle policy.
1. is there a limit on how many application versions can be stored for an app?
2. what is the limit?
3. what happens if you reach the limit?
4. how do you address this?
5. will versions currently in use be deleted?
6. do you have the option to not delete the source bundle in s3, thereby ensuring no data loss?
- yes.
- elastic beanstalk can store at most 1000 app versions.
- if you dont’ remove old versions, you won’t be able to deploy anymore.
- To phase out old app versions, use a lifecycle policy. You can base this on time (oldest versions removed) or space (when you have too many versions)
- no
- By default, Elastic Beanstalk leaves the application version’s source bundle in Amazon S3 to prevent loss of data. You can delete the source bundle to save space.
You can use elastic beanstalk extensions to customize your elastic beanstalk environment.
1. What is the name of the directory, and where is the directory located, that helps with this
2. can you set all the parameters in the UI by using these code files?
3. when do we use these?
4. what is needed to use elastic beanstalk extensions?
5. what happens if the environment goes away?
- .ebextensions/ it’s located in the root of the source code
- yes
- when you’re going to be sending up a zip fie containing code to elastic beanstalk anyway? real fuzzy on this one
- you need files in the .ebextensions directory; yaml or json format; .config extensions (for example, logging.config); ability to modify some default settings using option_settings; ability to add resources such as RDS, ElastiCache, DynamoDB etc
- resources managed by .ebextensions get deleted if the environment goes away