With Elastic Beanstalk, you can quickly deploy and manage applications in the AWS Cloud without having to learn about the infrastructure that runs those applications. Elastic Beanstalk reduces management complexity without restricting choice or control.
You simply upload your application, and Elastic Beanstalk automatically handles the details of capacity provisioning, load balancing, scaling, and application health monitoring.
Elastic Beanstalk supports applications developed in Go, Java, .NET, Node.js, PHP, Python, and Ruby. When you deploy your application, Elastic Beanstalk builds the selected supported platform version and provisions one or more AWS resources, such as Amazon EC2 instances, to run your application.
You can interact with Elastic Beanstalk by using the Elastic Beanstalk console, the AWS Command Line Interface (AWS CLI), or eb, a high-level CLI designed specifically for Elastic Beanstalk.
You can also perform most deployment tasks, such as changing the size of your fleet of Amazon EC2 instances or monitoring your application, directly from the Elastic Beanstalk web interface (console).
Layers of EB
AWS Elastic Beanstalk enables you to manage all of the resources that run your application as environments. Here are some key Elastic Beanstalk concepts.
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.
Application version
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 Java WAR 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.
Environment
An environment is a collection of AWS resources running an application version. Each environment runs only one application version at a time, however, you can run the same application version or different application versions in many environments simultaneously. When you create an environment, Elastic Beanstalk provisions the resources needed to run the application version you specified.
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).
Web server environments
The following diagram shows an example Elastic Beanstalk architecture for a web server environment tier, and shows how the components in that type of environment tier work together.
Environment Overview
Heart of the Application:
Environment is central to running your application.
Provisioned with necessary AWS resources like Elastic Load Balancer (ELB), Auto Scaling group, and Amazon EC2 instances.
URL and DNS
CNAME (URL):
Each environment has a URL (e.g., myapp.us-west-2.elasticbeanstalk.com).
This URL points to an ELB and is aliased using Amazon Route 53 via a CNAME record.
Amazon Route 53 handles secure and reliable DNS routing.
Load Balancer and Auto Scaling
Load Balancer:
Positioned in front of Amazon EC2 instances.
Auto Scaling:
Automatically scales Amazon EC2 instances based on load.
Ensures at least one instance is always running.
Software Stack and Host Manager
Container Types:
Define infrastructure topology and software stack (e.g., Apache Tomcat on Amazon Linux).
Host Manager (HM):
Runs on each Amazon EC2 instance.
Responsibilities include:
Deploying the application.
Aggregating and reporting metrics, events, and server status.
Monitoring logs and application server.
Patching and rotating log files, publishing them to Amazon S3.
Security Groups
Firewall Rules:
Security groups define firewall rules for instances.
Default security group allows connections via port 80 (HTTP).
Multiple security groups can be defined, e.g., for database servers.
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 an Amazon SQS queue if you don’t already have one. When you launch a worker environment, 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. The daemon reads messages from an Amazon SQS queue. The daemon sends data from each message that it reads to the web application running in the worker environment for processing. If you have multiple instances in your worker environment, each instance has its own daemon, but they all read from the same Amazon SQS queue.
The following diagram shows the different components and their interactions across environments and AWS services.