What is AWS Elastic Beanstalk?

AWS Elastic Beanstalk is an orchestration service offered by Amazon Web Services for deploying applications that orchestrate various AWS services, including EC2, S3, Simple Notification Service, CloudWatch, autoscaling, and Elastic Load Balancers. Elastic Beanstalk provides an additional layer of abstraction over the bare server and OS; users instead see a pre-built combination of OS and platform such as Ruby on Ubuntu 64 bit or Apache 2.1 on Amazon Linux etc.

With Elastic Beanstalk, users 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. Users simply upload their application, and Elastic Beanstalk automatically handles the details of capacity provisioning, load balancing, scaling, and application health monitoring, etc.

Elastic Beanstalk supports applications developed in Go, Java, .NET, Node.js, PHP, Python, and Ruby. When users deploy their 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. Users 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.

In this blog, we are going to describe the steps involved in creating a new web application with a sample code. Users are allowed to use their code also. By creating an environment, users allow AWS Elastic Beanstalk to manage AWS resources and permissions on behalf of their DevOps Infrastructure management.

Creating a web application on AWS Elastic Beanstalk

Login to AWS web console using a root user credential. Choose Elastic Beanstalk under All Services — Compute and select Create Application button

Download Banner

Elastic Beanstalk on AWS

In this step, we are creating a web application using PHP on an Amazon Linux EC2 instance with sample code. Providing a web application name VembuDemoBeanstalk. On the Platform configuration section choose

  • PHP from the drop-down list as the platform
  • PHP 7.4 running on 64 bit Amazon Linux 2 from the drop-down list as platform branch
  • Platform version 3.1.5 version ( recommended version )

On Application code selection, choose sample application. This option gets started right away with sample code. Users can also choose “upload your code” if the user uploads a source bundle from his computer or copy one from Amazon S3.

Elastic Beanstalk on AWS

Click Create application

AWS chooses a predefined configuration for the said PHP application which is called a preset configuration. You can also choose the custom configuration to edit the parameters such as Software, EC2 Instances, Capacity, Rolling updates and deployment policy, Security, Monitoring, and notifications as shown in the below image. You can edit each parameter and can change the value before launching the web application.

In our example, we have chosen a Single instance with a Free tier eligible option under configuration presets. Depending on the requirement you may choose the High availability option with on-demand instances too.

Elastic Beanstalk on AWS

Once you are done with the configuration options, click Create an app to proceed to the next step.

AWS creates a web application in a few minutes, and the user can see the progress as shown in the below image.

Elastic Beanstalk on AWS

Once the web application is created, you can see the web application environment main page as shown below. Here the example web application “Vembudemobeanstalk-env” environment shown with health status as OK with recent events related to the web environment.

Elastic Beanstalk on AWS

You can also click the web application URL created to check your environment is created without any issue. You will get a successful response from the web application URL as below

Elastic Beanstalk on AWS

Working with ElasticBeanstalk Web application through Actions Menu

Now a basic web application environment is created, on our next step, we are going to describe the various actions carried out on the web application environment in the AWS console. After selecting the newly created web environment under the Elastic Beanstalk → Environments menu, you can view the actions to be carried out on the web environment as the below screenshot shows those actions mentioned in the Redbox.

Available actions are :

  • Load configuration
  • Save configuration
  • Swap Environment URLs
  • Clone Environment
  • Abort Current operation
  • Restart app server(s)
  • Rebuild Environment
  • Terminate Environment

Elastic Beanstalk on AWS

Load configuration – Using this menu, you can load the already saved configuration. A saved configuration is a template that you can use as a starting point for creating unique Elastic Beanstalk environment configurations.

Save configuration – Using this menu, you can create a new configuration, or can save the current configuration of your environment for rollback or reuse. The user needs to provide a configuration name and description for the configuration. When saving a configuration, you can specify tags. These tags are added to environments to which you later apply this saved configuration.

Swap Environment URLs – This can be used when you swap an environment’s URL with another environment’s URL, you can deploy versions with no downtime. This method of deploying new application versions lets you avoid application downtime. You stage the new version in a new environment, then swap its URL with the URL of the existing production environment

Clone Environment – It is nothing but launching a new Elastic Beanstalk environment with the same configuration as your currently running environment.

Restart app server(s) – This will initiate a total restart of its resources including EC2 instance restart.

Rebuild Environment – This will initiate a delete operation of your currently running environment, and recreate all the resources based on the configuration you saved at the time of creating the new environment.

Terminate Environment – This will delete all the resources attached to the environment. This includes deleting EC2 instances, storage components including DB. Any additional resources associated with the Elastic Beanstalk environment will be destroyed.

Managing an Elastic Beanstalk Environment on AWS console.

Below utilities will help you to efficiently manage the running Elastic Beanstalk Environment, which is available in the AWS console, shown in a red-colored box.

Configuration, Logs, Health, Monitoring, Alarms, Managed Updates, Events, and Tags.

Configuration – The Configuration overview page shows a summary of environment configuration option values, grouped by category. For each category, you can edit all the listed options you provided during the initial configuration of the web environment.

Logs – You can download logs of all the webserver instances in the Elastic BeanStalk environment. Either you can view the last 100 lines of the logs or the entire logs of each server instance in the Elastic BeanStalk environment.

Health – The Health page shows live enhanced health information about every instance in your environment. Enhanced health monitoring lets Elastic Beanstalk closely monitor the resources in your environment so that it can assess the health of your application more accurately.

Monitoring – The Monitoring page shows an overview of health-related metrics for your environment. This includes the default set of metrics provided by Elastic Load Balancing and Amazon EC2 and graphs that show how the environment’s health has changed over time. You can view a graphical representation of all web instance resources based on a period range from 1 minute to 1 day.

Alarms – The Alarms page shows alarms that you configured for environment metrics. You can see each metric’s definition and the recent history of the underlying metric. You can modify or delete alarms. This an SNS mail service, where you can configure email alerts for each alarm.

Managed updates – 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. Elastic Beanstalk outputs event messages whenever you interact with the environment, and when any of your environment’s resources are created or modified as a result.

Tags – The Tags page shows the tags that you applied to your environment (and a few default ones). Tags are key-value pairs associated with AWS resources.

Elastic Beanstalk on AWS

Conclusion

The main advantage of having Elastic Beanstalk includes timesaving server configuration, powerful customization, and a cost-effective price point. Elastic Beanstalk automates the setup, configuration, and provisioning of other AWS services like EC2, RDS, and Elastic Load Balancing to create a web service from a single place in quick time. It’s for the people who are looking for a tool to reduce system operations and just focus on what you’re developing, Elastic Beanstalk is a good choice.

Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.

Like what you read? Rate us