When you launch an Elastic Beanstalk environment, you choose an environment tier, platform, and environment type. The environment tier that you choose determines whether Elastic Beanstalk provisions resources to support a web application that handles HTTP(S) requests or a web application that handles background-processing tasks. An environment tier whose web application processes web requests is known as a web server tier. An environment tier whose web application runs background jobs is known as a worker tier. This topic describes the components, resources, and architecture for each type of environment tier.
One environment cannot support two different environment tiers because each requires its own set of resources; a worker environment tier and a web server environment tier each require an Auto Scaling group, but Elastic Beanstalk supports only one Auto Scaling group per environment.
Web Server Environment Tiers
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. The remainder of this section discusses all the components in more detail.
The environment is the heart of the application. In the diagram, the environment is delineated by the solid blue line. When you create an environment, Elastic Beanstalk provisions the resources required to run your application. AWS resources created for an environment include one elastic load balancer (ELB in the diagram), an Auto Scaling group, and one or more Amazon EC2 instances.
Every environment has a CNAME (URL) that points to a load balancer. The environment has
a URL such as
myapp.us-west-2.elasticbeanstalk.com. This URL is aliased in Amazon Route 53 to an Elastic Load Balancing
abcdef-123456.us-west-2.elb.amazonaws.com—by using a CNAME record.
Amazon Route 53 is a highly available
and scalable Domain Name System (DNS) web service. It provides secure and reliable routing
to your infrastructure. Your domain name that you registered with your DNS provider will
forward requests to the CNAME. The load balancer sits in front of the Amazon EC2 instances,
which are part of an Auto Scaling group. (The Auto Scaling group is delineated in the
diagram by a broken black line.) Auto Scaling automatically starts additional Amazon EC2
instances to accommodate increasing load on your application. If the load on your
application decreases, Auto Scaling stops instances, but always leaves at least one instance
The software stack running on the Amazon EC2 instances is dependent on the container type. A container type defines the infrastructure topology and software stack to be used for that environment. For example, an Elastic Beanstalk environment with an Apache Tomcat container uses the Amazon Linux operating system, Apache web server, and Apache Tomcat software. For a list of supported container types, see Supported Platforms. Each Amazon EC2 server instance that runs your application uses one of these container types. In addition, a software component called the host manager (HM) runs on each Amazon EC2 server instance. (In the diagram, the HM is an orange circle in each EC2 instance.) The host manager is responsible for:
Deploying the application
Aggregating events and metrics for retrieval via the console, the API, or the command line
Generating instance-level events
Monitoring the application log files for critical errors
Monitoring the application server
Patching instance components
Rotating your application's log files and publishing them to Amazon S3
The host manager reports metrics, errors and events, and server instance status, which are available via the AWS Management Console, APIs, and CLIs.
The Amazon EC2 instances shown in the diagram are part of one security group. A security group defines the firewall rules for your instances. By default, Elastic Beanstalk defines a security group, which allows everyone to connect using port 80 (HTTP). You can define more than one security group. For instance, you can define a security group for your database server. For more information about Amazon EC2 security groups and how to configure them for your Elastic Beanstalk application, see the Security Groups.
Worker Environment Tiers
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 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. The daemon is responsible for pulling requests from an Amazon SQS queue and then sending the data to the web application running in the worker environment tier that will process those messages. If you have multiple instances in your worker environment tier, 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.
Amazon CloudWatch is used for alarms and health monitoring. For more information, go to Basic Health Reporting.
For details about how the worker environment tier works, see How a Worker Environment Works.