AWS – Elastic Beanstalk
Elastic Beanstalk is a PaaS or Platform as a Service offered by AWS.
Its an “orchestration service” used to enable easy deployment and scaling of web applications and services.
It supports Java, Python, Ruby, .NET, PHP, Node.js, Go, Docker and server services such as Apache, Nginx, and MS-IIS.
Elastic Beanstalk takes care of deployment, capacity provisioning, auto-scaling, load balancing, and application health monitoring.
Elastic Beanstalk is free to use. There is no charge for using Elastic Beanstalk itself to deploy your applications.
However, note that you are charged for the resources that are created by Beanstalk to support your application.
Elastic Beanstalk is fast and simple to deploy. You just use the AWS Management Console, a Git repository, or alternatively, you can use an IDE or integrated development environment such as Visual Studio to upload your application to AWS.
Elastic Beanstalk then automatically handles the necessary deployment resources such as capacity provisioning, auto-scaling, load balancing, and application health monitoring.
It’s also highly scalable, automatically scaling your application up or down according to the specific requirements of application by means of configurable Auto Scaling settings.
For example, you can monitor your CPU utilization metrics in order to set Auto Scaling actions and so allow your application to comfortably handle peaks in traffic or workload volumes while also minimizing running costs.
It also allows for greater developer productivity by taking care of provisioning and infrastructure operation. In this way you can concentrate on writing and running your development code without having to create your own infrastructure from the ground up in order to run it.
A quick overview of some concepts and definitions used by Elastic Beanstalk
Application: Elastic Beanstalk application is a logical collection of Elastic Beanstalk components. These include environments, environment configurations and versions. An application in Elastic Beanstalk is conceptually similar to a folder.
Application version: This is a specific, definied instance of deployable code for a web application. An application version points to an S3 object that contains the deployable code, for example a Python WAR file.
Environment: An environment is a group of AWS resources that run an application version. Each environment can run only one application version at any one time. However, it is possible to run the same or different application versions in many environments simultaneously.
Environment configuration: this determines a collection of parameters and settings which define how an environment and its associated resources will behave.
When you modify an environment’s configuration settings it will automatically apply the changes to your existing resources and deletes and deploys new resources according to the changes you have specified in the configuration settings.
Saved configuration: This is a template that serves as a basis for creating unique environment configurations for Elastic Beanstalk. You can create and modify saved configurations and then apply them to environments through the Elastic Beanstalk console, AWS CLI, EB CLI, or API.
Platform: This refers to the combination of the operating system, programming language, application or web server, and Elastic Beanstalk components.
How to use Elastic Beanstalk
With Elastic Beanstalk, you first create an application, then upload an application version in the form of an application code bundle -this could be for example a Python .war file, to Elastic Beanstalk. You then provide some additional information about the application and Elastic Beanstalk then automatically launches an environment, and creates and configures the resources required to run your code.
After your environment launch, you can then manage the environment and deploy new application versions as required.
The resources that are created when you deploy an application in Elastic Beanstalk will typically include the following:
Elastic Beanstalk Environment
Elastic Load Balancer
Auto Scaling Group
The main Elastic Beanstalk Components in more detail
When you create an application, you will usually want to place all the related components such as program code, resource configuration templates, code versions and required files in a folder.
An Elastic Beanstalk application is in effect a similar concept, serving as the container that holds all the related files, platform resources and configuration information needed to run the application on Elastic Beanstalk.
When you create and deploy a new application or application version, the application name will then be displayed in the Elastic Beanstalk console.
The application version is a specific labeled iteration of deployable code used by your web application and is a link to an S3 object that contains your deployable Zip or Java WAR file.
The named version will then appear as a new application if you choose to deploy it into a different environment rather than deploying it within an existing application.
The environment contains the version of the application you are deploying. It hosts all the required EC2 instances, storage, load balancer, autoscaling groups, and any other resources required for this application version.
A single environment can only run one version of your application. You can deploy your new version over the top of an existing application environment, like say production, however you also have the flexibility to install to alternative environments like development, staging or testing environments.
Each environment will have a unique URL to access the running application.
Two environment tiers are created when you deploy an application using Elastic Beanstalk.
The Web Server environment tier and the Worker environment tier. The Web Server environment tier is the front-facing segment that handles http/s requests from users when they access the application URL
A Worker environment tier is a background service that processes the requests passed to it by the web server tier. It also runs workload-processing background tasks. You can also deploy code directly in the worker environment tier instead within the main web server application.
Elastic Beanstalk monitors your web server applications and worker environments and performs various health checks to show how the application is running.