Get started with AWS Elastic Beanstalk

AWS Elastic Beanstalk is a Platform as a Service (PaaS) offered by Amazon Web Services (AWS) that enables developers to quickly deploy and manage applications in the AWS cloud. It abstracts much of the underlying infrastructure and platform, allowing developers to focus on writing code rather than managing servers, networks, and other lower-level details.

AWS Elastic Beanstalk deploys web applications so that you can focus on your business.

Here's a deeper look at the key aspects of AWS Elastic Beanstalk:

  1. Simplified Deployment: You can upload your code, and Elastic Beanstalk will handle the deployment process, including capacity provisioning, load balancing, auto-scaling, and monitoring. Supported languages include Java, .NET, Node.js, Python, Ruby, PHP, and more.

  2. Environment Management: Elastic Beanstalk provides pre-configured environments tailored to specific application types. You can also customize the environment by modifying the configurations, or even by adding configuration files directly into your code repository.

  3. Automatic Scaling: It has the ability to automatically scale an application up and down based on the rules defined by using Auto Scaling Groups. You can control how much it scales and in response to what triggers.

  4. Health Monitoring: You can monitor the health of your application through the AWS Management Console, the AWS Command Line Interface (CLI), or programmatically through AWS SDKs. Elastic Beanstalk aggregates data and provides visualizations to help you understand how your application is performing.

  5. Integration with AWS Services: It's integrated with other AWS services like Amazon RDS, Amazon S3, Amazon CloudWatch, etc., enabling you to enhance your application with various functionalities and data services.

  6. Control and Flexibility: While it provides a simplified way to deploy applications, Elastic Beanstalk doesn't limit you to its predefined structure. If you need to, you can access the underlying resources directly. You can manage the resources (like EC2 instances) within the Elastic Beanstalk environment, providing a balance of convenience and control.

  7. Cost: You only pay for the underlying AWS resources (e.g., EC2 instances, S3 buckets) that your application uses. There is no additional charge for Elastic Beanstalk itself.

  8. Version Management: Elastic Beanstalk allows you to maintain different versions of your application so you can deploy different versions to different environments, roll back to previous versions, or run A/B tests.

  9. Maintenance and Updates: Elastic Beanstalk provides managed platform updates, ensuring that the underlying infrastructure is up to date with security patches and updates.

AWS Elastic Beanstalk works by abstracting the underlying infrastructure and allowing developers to easily deploy and manage applications. Here's how the process generally unfolds:

  1. Application Creation: You begin by creating an application, which is a logical collection of Elastic Beanstalk components, including environments, versions, and environment configurations.

  2. Environment Setup: Within an application, you can create one or more "environments," which are configurations specifying the platform (like Node.js, Java, etc.) and the underlying resources like EC2 instances, RDS databases, etc. You can select a pre-configured environment or customize it to your needs.

  3. Code Deployment: Once the environment is set up, you can deploy your application code. You package your code and any associated dependencies and upload them to Elastic Beanstalk either via the AWS Management Console, CLI, or directly through an integrated development environment (IDE) like Eclipse or Visual Studio.

  4. Resource Provisioning: Elastic Beanstalk then automatically handles the details of capacity provisioning, load balancing, scaling, and application health monitoring. It will set up all necessary AWS resources such as Amazon EC2 instances, Amazon RDS instances, Elastic Load Balancers, etc., according to the environment configuration.

  5. Automatic Scaling: Depending on the demands on your application, Elastic Beanstalk can automatically scale the number of running EC2 instances up or down. You can set scaling triggers based on metrics like CPU utilization or network I/O.

  6. Monitoring and Management: Through the Elastic Beanstalk dashboard, CLI, or SDKs, you can monitor the health and performance of your application and environment. AWS CloudWatch is integrated for more detailed metrics.

  7. Updates and Maintenance: Elastic Beanstalk manages updates and maintenance of the platform itself. You can also deploy updates to your application by simply uploading a new version of your code.

  8. Extensions and Customization: You have the flexibility to customize the environment through configuration files. These allow you to install software packages, set environment variables, configure the application server, and more.

  9. Integration with Other AWS Services: Your application within Elastic Beanstalk can interact with a wide range of AWS services such as Amazon RDS, Amazon S3, AWS Lambda, etc.

  10. Termination: If you no longer need an environment, you can terminate it, which stops and deletes all resources associated with it.

  11. Versioning and Promotion: You can maintain different versions of your application and deploy different versions to different environments, facilitating stages like development, testing, and production.

By managing all these aspects, Elastic Beanstalk simplifies the process of deploying and scaling applications, freeing developers from many of the complexities of infrastructure management. This allows them to focus more on developing their applications and less on managing servers, databases, load balancers, and other infrastructure components.

AWS Elastic Beanstalk does utilize AWS CloudFormation as part of its underlying service architecture. When you create an environment in Elastic Beanstalk, it translates the requirements and configurations into a CloudFormation template. CloudFormation then takes this template and provisions and configures the resources in the template, like EC2 instances, load balancers, security groups, and more.

CloudFormation provides a common language for describing and provisioning all the infrastructure resources in a cloud environment. By using CloudFormation, Elastic Beanstalk can take advantage of a well-defined method for creating, managing, and configuring resources within AWS.

This integration allows Elastic Beanstalk to provide a higher-level, more developer-friendly interface for application deployment and management, while still benefiting from the powerful infrastructure-as-code capabilities of CloudFormation. It also offers the possibility of directly accessing and manipulating underlying resources if more control is needed. Therefore, while Elastic Beanstalk abstracts much of the underlying complexity from the developer, the CloudFormation templates can still be viewed and manually edited if needed.

In summary, AWS Elastic Beanstalk is a powerful tool for developers who want to deploy and manage applications in the cloud without worrying about the underlying infrastructure. It's a suitable choice for small to large-scale applications, whether you need a single instance or a full-fledged, highly available environment.

Hands-On Lab: Create a simple web application with Elastic Beanstalk via Management Console

In this hands-on lab, we will practice how to launch the basic sample web app with Elastic Beanstalk service via Management Console.

  1. Go to Elastic Beanstalk console and press the "Create application" button:

  2. In the Environment tier choose "Web server environment":

    When you create an Elastic Beanstalk environment, you first choose an environment tier.

    It's the type of application that the environment runs, and determines which resources Elastic Beanstalk provisions to support it.

    Choose one of these tiers:

    • Web server environment – Run a website, web application, or web API that serves HTTP requests.

    • Worker environment – Run a worker application that processes long-running workloads on demand or performs tasks on a schedule.

  3. Fill in the application name:

An Elastic Beanstalk application is a logical collection of Elastic Beanstalk components, including environments, application versions, and saved configurations. In Elastic Beanstalk an application is conceptually similar to a folder.

Details you provide here:

  • Application name

  • Description – A free text field describing your application. You can describe the application's purpose and the environments that you intend to include in it.

Tags – Key-value pairs associated with your application.

  1. Provide Environment information:

An environment is a collection of AWS resources running a version of your application code. When you create an environment, Elastic Beanstalk provisions the resources needed to run the application version you specified.

Key details you provide here:

  • Environment name

  • Domain – A subdomain for accessing your web application.

  • Environment description (optional)

  1. Choose NodeJS platform for our Sample app:

A platform is a a combination of an operating system (OS), runtime, web server, application server, and Elastic Beanstalk components. Platforms provide components that are available to run your application. Select a value from the Platform list. Elastic Beanstalk defaults the latest Platform branch and Platform version.

  1. Use Sample app provided by AWS for NodeJS platform:

Provide the details that Elastic Beanstalk needs to source the code for your new application. Select the Elastic Beanstalk sample application, an existing application version, or new code to upload.

Learn more:

  1. Select "Single Instance" preset:

Select a preset configuration that matches your use case. Each preset includes recommend values for several configuration options.

The Single instance presets are primarily recommended for development use cases and will save costs. The High availability presets are recommended for production environments. They include a load balancer and scale with multiple instances in response to load. If Custom configurations is selected, Elastic Beanstalk will provide the standard default values. Choose this option if you are deploying a source bundle with configuration files.

  1. Next, we need to configure service access. To configure service access we need to create a new service role and EC2 instance profile to allow the EC2 service to perform the required operations:

At first, you will find that EC2 instance profile dropdown is empty. In order to fill it and select the required role, we need to create this profile manually.

To create EC2 instance profile we need to go to the IAM console and create the role:

Attach the following policies related to ElasticBeanstalk service:

Provide the role name and create it:

After role creation it should be visible in the drop-down menu of the EC2 instance profile:

Elastic Beanstalk is allowed to access other services to manage your environment by assuming a service role. Choose an existing role or create a new role.

The default service role is aws-elasticbeanstalk-service-role. Select this role or another existing one from the drop-down list.

Alternatively, you may choose to create a new service role. Elastic Beanstalk attaches the same permission policies to the service roles created from this screen. You may later modify them through the AWS Identity and Access Management (IAM) service.

A typical case for creating a new service role is a test environment that has different permission requirements than a production environment. In this case the test and production environments would each require a different service role.

Things you can do on this page:

  • Choose a service role for Elastic Beanstalk to manage your environment.

  • Choose an Amazon EC2 key pair to connect to your environment's instances. You need the private key to connect.

  • Choose an EC2 instance profile. Your environment's Amazon EC2 instances use the IAM instance profile to access other AWS services and perform required operations. Use the IAM service if you need to add permissions to the default instance profile. You may also create your own instance profile via the IAM service and afterwords choose it from this screen.

  • Select Next to move on to the next set of options, or select Skip to review to view currently selected option values for your environment.

Learn more:

  1. Next, we can skip the rest of the options by pressing the "Skip to review" button:

  2. Finally, after review press the "Submit" button to deploy your Elastic Beanstalk app. In the "Events" tab you will find the information regarding creation of the underlying resources.

  3. Now you can access your deployed NodeJS app by visiting the domain address from the environment overview tab:

This shows the power of the Elastic Beanstalk platform, by removing the complexity of infrastructure provisioning for Developers. In several minutes you can launch fully functioning NodeJS app with a dedicated domain name.


  1. AWS Elastic Beanstalk

  2. AWS Elastic Beanstalk Documentation

  3. Getting started using Elastic Beanstalk

  4. Deploying Node.js applications to Elastic Beanstalk