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.
It is a logical collection of Elastic Beanstalk components, including environments, versions, and environment configurations. It looks like a folder.
- Application Version:
An application version is a distributable code, such as a Java WAR file. An application version is part of an application.
There is a collection of AWS resources running our application version, e.g. EC2 Instances, LoadBalancers, Security Groups, etc
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.
- AWS Account ( Create if you do not have one).
What will we do?
- Login to AWS.
- Configure and create Elastic Beanstalk Application
- Exit application
Log in to AWS
- 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.
 When we have successfully logged in to AWS we will see the main console with all the services listed as follows.
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.
On this welcome screen, click "Get started" to create our first application.
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.
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.
Under "Software", we can provide environment variables, enable log flow, enable rotating logs etc.
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.
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
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.
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.
When we have hit the application we can see that the sample program is now available from the browser.
To remove the application if it is no longer needed, click "Actions" -> "Exit environment". 
Enter the application name in the text box and click "Exit". Ads
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.