Home / How To / How to set up an Elastic Beanstalk application on AWS

How to set up an Elastic Beanstalk application on AWS



Elastic Beanstalk is one of the "computer services" in Amazon Web Services (AWS) cloud. This allows us to easily manage and distribute applications. We do not need to understand or learn the services required to run our application. With Elastic Beanstalk we only need to upload our application and Elastic Beanstalk takes care of the rest. Elastic Beanstalk supports applications developed in Java, .NET, Go, PHP, Python, Node.js and Ruby.

We can interact with Elastic Beanstalk using the AWS Management Console, Command Line Interface.

To use Elastic Beanstalk, all we need to do is build our application, upload its version in the form of a source bundle (eg the Java application requires a .war file) and then provide some information about the application . Elastic Beanstalk then automatically creates an environment and creates and configures the AWS resources needed for our code. Elastic Beanstalk even manages the environment itself. We do not have to worry about high availability, scaling, etc.

There is no extra charge for Elastic Beanstalk. We only pay for the AWS resources that our application will use and need. For pricing, see the official AWS documentation here.

Before we continue, let's understand some basic concepts of Elastic Beanstalk.

  1. Application:
    It is a logical collection of Elastic Beanstalk components, including environments, versions, and environment configurations. It looks like a folder.
  2. Application Version:
    An application version is a distributable code, such as a Java WAR file. An application version is part of an application.
  3. Environment:
    There is a collection of AWS resources running our application version, e.g. EC2 Instances, LoadBalancers, Security Groups, etc
  4. Platform:
    It is a combination of operating system, programming language runtime, application server and Elastic Beanstalk components.

In this article we will see how to create an Elastic Beanstalk application with a sample code example.

Requirements

  1. AWS Account ( Create if you do not have one).

What will we do?

  1. Login to AWS.
  2. Configure and create Elastic Beanstalk Application
  3. Exit application

Log in to AWS

  1. Click here to go to AWS login page.

When we click on the above link, we will see a web page in the following way where we have to log in with our login details.

 Login to AWS [19659004] When we have successfully logged in to AWS we will see the main console with all the services listed as follows.

 AWS Management console

Configuring and creating an Elastic Beanstalk application

To create an Elastic Beanstalk application, click on "Service" on the upper left screen and search for "Elastic Beanstalk" in the search box and click on the result.

 Create an Elastic Beanstalk application

On this welcome screen, click "Get started" to create our first application.

 Welcome to Elastic Beanstalk

Here we can give a name to the application, specify which platform we choose. Here I have specified the Java platform when we are going to proceed with the test application.

Before we continue and click "Create Application", click "Configure More Options" to see available options.

 Creating web app

We will see the following screen where we can see that we have many configurations available. Here I continue with "Single Instance" because it is eligible for Free Tier, but for production purposes we should not go with this type.

 Configure the application

Under "Software", we can provide environment variables, enable log flow, enable rotating logs etc.

 Changing software

Under “Instance” we can choose the type of root volume to use for the EC2 instance. The default is "Container" which does not require specifying the size. We can even use the existing security groups or Elastic Beanstalk will create the required one.

 Change Instances

Under "Capacity" we can see Min and Max instances is 1 which we have chosen a free optional instance type in the previous step.

Similarly, you can explore various available options and click "Create Application" on the main page to create our first Elastic Beanstalk application. Advertising Services

 Modify Capacity

Now the necessary resources are created such as EC2 instance, security group, scaling policy, load balancer etc. This will take some time, wait until then.

 Creating the application

After a while, in the logs, we can see that the application has been successfully distributed and now available for access. To access the application Hit the available URL for the application.

 Access to the application with its URL

When we have hit the application we can see that the sample program is now available from the browser.

 Example application

Delete application

To remove the application if it is no longer needed, click "Actions" -> "Exit environment". [19659004]   Remove the application from AWS

Enter the application name in the text box and click "Exit". Ads

 Confirm End of Environment

Conclusion:

In this article we saw the steps to create a very first Elastic Beanstalk application with the sample code. We also saw how easily the application can be terminated.


Source link