2. Amazon Elastic BeanStalk
2
▪ AWS Elastic Beanstalk 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.
▪ You can simply upload your code and Elastic Beanstalk automatically
handles the deployment, from capacity provisioning, load balancing,
auto-scaling to application health monitoring. At the same time, you
retain full control over the AWS resources powering your application
and can access the underlying resources at any time.
▪ There is no additional charge for Elastic Beanstalk - you pay only for
the AWS resources needed to store and run your applications.
3. Amazon Elastic BeanStalk
3
▪ You can also perform most deployment tasks, such as changing
the size of your fleet ofAmazon EC2 instances or monitoring
your application, directly from the Elastic Beanstalk web
interface (console).
▪ To use Elastic Beanstalk, you create an application, upload an
application version in the form of an application source bundle
(for example, a Java .war file) to Elastic Beanstalk, and then
provide some information about the application.
▪ Elastic Beanstalk automatically launches an environment and
creates and configures the AWS resources needed to run your
code. After your environment is launched, you can then manage
your environment and deploy new application versions.
5. Amazon Elastic BeanStalk
5
▪ This following diagram illustrates an example Elastic Beanstalk
architecture for a web server environment tier and shows how the
components in that type of environment tier work together.
6. AWS Elastic BeanStalk Supported
Platforms
6
▪ AWS Elastic Beanstalk provides platforms for programming languages (Java,
PHP, Python, Ruby, Go), web containers (Tomcat, Passenger, Puma) and Docker
containers, with multiple configurations of each.
▪ Elastic Beanstalk provisions the resources needed to run your application,
including one or more Amazon EC2 instances.The software stack running on the
Amazon EC2 instances depends on the configuration.
▪ Platforms
PackerBuilder SingleContainerDocker
MulticontainerDocker PreconfiguredDocker
Go JavaSE
JavawithTomcat .NETonWindowsServerwithIIS
Node.js PHP
Python
7. AWS Elastic BeanStalk
Concepts
7
AWS Elastic Beanstalk lets you manage all of the resources that run your
application as environments. Let's take a closer look at what these terms
mean.
▪ Application
– An Elastic Beanstalk application is a logical collection of Elastic Beanstalk
components, including environments, versions, and environment configurations. In
Elastic Beanstalk an application is conceptually similar to a folder.
▪ ApplicationVersion
– In Elastic Beanstalk, an application version refers to a specific, labeled iteration of
deployable code for a web application. An application version points to an
Amazon Simple Storage Service (Amazon S3) object that contains the deployable
code such as a JavaWAR file.An application version is part of an application.
Applications can have many versions and each application version is unique. In a
running environment, you can deploy any application version you already
uploaded to the application or you can upload and immediately deploy a new
application version.You might upload multiple application versions to test
differences between one version of your web application and another.
8. AWS Elastic BeanStalk
Concepts
8
▪ Environment
– An environment is a version that is deployed onto AWS resources. Each
environment runs only a single application version at a time, however you can
run the same version or different versions in many environments at the same
time.When you create an environment, Elastic Beanstalk provisions the
resources needed to run the application version you specified.
▪ EnvironmentTier
– When you launch an Elastic Beanstalk environment, you first choose an
environment tier.The environment tier that you choose determines whether
Elastic Beanstalk provisions resources to support an application that handles
HTTP requests or an application that pulls tasks from a queue. An application
that serves HTTP requests runs in a web server environment.An environment
that pulls tasks from anAmazon Simple Queue Service queue runs in a worker
environment .
9. AWS Elastic Beanstalk
Concepts
9
▪ Environment Configuration
– An environment configuration identifies a collection of parameters and
settings that define how an environment and its associated resources behave.
When you update an environment’s configuration settings, Elastic Beanstalk
automatically applies the changes to existing resources or deletes and
deploys new resources (depending on the type of change).
▪ ConfigurationTemplate
– A configuration template is a starting point for creating unique environment
configurations.Configuration templates can be created or modified by using
the Elastic Beanstalk command line utilities or API.
▪ Web Server Environments
– Same as the web Application diagram before suggested.
10. AWS Elastic Beanstalk
Concepts
10
▪ Worker Environments
– AWS resources created for a worker environment tier include an Auto Scaling
group, one or more Amazon EC2 instances, and an IAM role. For the worker
environment tier, Elastic Beanstalk also creates and provisions anAmazon
SQS queue if you don’t already have one.When you launch a worker
environment tier, Elastic Beanstalk installs the necessary support files for
your programming language of choice and a daemon on each EC2 instance in
the Auto Scaling group.
▪ Design Considerations
– Because applications deployed using Elastic Beanstalk run on Amazon cloud
resources, you should keep several things in mind when designing your
application: scalability, security, persistent storage, fault tolerance, content
delivery, software updates and patching, and connectivity.
16. Create an Elastic Beanstalk
Environment
16
▪ AWS Elastic Beanstalk in Action (6)
17. Managing Elastic Beanstalk
Environments
17
▪ AWS Elastic Beanstalk makes it easy to create new environments for
your application.You can create and manage separate environments for
development, testing, and production use, and you can deploy any
version of your application to any environment. Environments can be
long-running or temporary.When you terminate an environment, you
can save its configuration to recreate it later.
▪ As you develop your application, you will deploy it often, possibly to
several different environments for different purposes. Elastic Beanstalk
lets you configure how deployments are performed .You can deploy to all
of the instances in your environment simultaneously, or split a
deployment into batches with rolling deployments.
▪ Configuration changes are processed separately from deployments, and
have their own scope. For example, if you change the type of the EC2
instances running your application, all of the instances must be replaced.
On the other hand, if you modify the configuration of the environment's
load balancer, that change can be made in-place without interrupting
service or lowering capacity.You can also apply configuration changes
that modify the instances in your environment in batches with rolling
configuration updates.
18. Managing Elastic Beanstalk
Environments
18
▪ Note
– Modify the resources in your environment only by using Elastic Beanstalk. If you
modify resources using another service's console, CLI commands, or SDKs, Elastic
Beanstalk won’t be able to accurately monitor the state of those resources, and
you won't be able to save the configuration or reliably recreate the environment.
Out-of band-changes can also cause issues when terminating an environment.
▪ When you launch an environment, you choose a platform configuration.
We update platform configurations periodically to provide performance
improvements and new features.You can update your environment to
the latest platform configuration at any time.
▪ As your application grows in complexity, you can split it into multiple
components, each running in a separate environment. For long-running
workloads, you can launch worker environments that process jobs from
an Amazon Simple Queue Service (Amazon SQS) queue.
19. Managing Elastic Beanstalk
Environments
19
▪ Note
– Modify the resources in your environment only by using Elastic Beanstalk. If you
modify resources using another service's console, CLI commands, or SDKs, Elastic
Beanstalk won’t be able to accurately monitor the state of those resources, and
you won't be able to save the configuration or reliably recreate the environment.
Out-of band-changes can also cause issues when terminating an environment.
▪ When you launch an environment, you choose a platform configuration.
We update platform configurations periodically to provide performance
improvements and new features.You can update your environment to
the latest platform configuration at any time.
▪ As your application grows in complexity, you can split it into multiple
components, each running in a separate environment. For long-running
workloads, you can launch worker environments that process jobs from
an Amazon Simple Queue Service (Amazon SQS) queue.
20. Managing Elastic Beanstalk
Environments
20
▪ Mainly managing could be done with following topics:
– Environment Dashboard - main view of the environment management
console is the dashboard
– Environment ManagementActions -The environment management console
contains an Actions menu that you can use to perform common operations
on your environment
– Configuration - The Configuration overview page shows the current
configuration of your environment and its resources, includingAmazon EC2
instances, load balancer, notifications, and health monitoring settings
– Logs -The Logs page lets you retrieve logs from the EC2 instances in your
environment
21. Managing Elastic Beanstalk
Environments
21
▪ Mainly managing could be done with following topics:
– Health - If enhanced health monitoring is enabled, the Enhanced Health
Overview page shows live health information about every instance in your
environment
– Monitoring -The Monitoring page shows an overview of health information
for your environment
– Alarms -The Existing Alarms page shows information about any alarms that
you have configured for your environment.
– ManagedUpdates - The Managed Updates page shows information about
upcoming and completed managed platform updates and instance
replacement
– Events -The Events page shows the event stream for your environment
– Tags -The Tags page shows the tags that you applied to the environment
when you created it
22. Limitations of Elastic
Beanstalk Environments
22
▪ Some of the biggest pains with Elastic Beanstalk include unreliable
deployments, lack of transparency and documentation around
stack and application upgrades, and an overall lack of clear
documentation.
– Unreliable Deployment - Deployment failure without notification and results
in further all failure on every commit (if on CICD pipeline)
– Deployment Speed - Deployments would take five minutes at least, and
sometimes stretch to 15, for a site with just two front-ends
– Stack Upgrades – Elastic beanstalk comes up with all new updates with no
release notes , no blog post, not even a forum post
– Old ApplicationVersions - With every deploy, Elastic Beanstalk archives the
old application version in an S3 bucket. However, if there are 500 old
versions, further deploys fail