Deploy your Artifact publicly using AWS Resource within 20 Minutes using AWS EBS AND RDS !!!! - High Level P-2
Tags: springboot, elasticbeanstalk, ec2
Published: 2022-03-31 07:54:04

## AWS EBS [Elastic Beanstalk] -

_Elastic Beanstalk is a platform within AWS that is used for deploying and scaling web applications_.

**Before starting the process configure the port no to 5000 in application.properties  file in your spring boot app.**

> server.port=5000

Now we need to deploy our application publicly using AWS EBS.

1. Search and open Elastic BeanStalk Service in AWS as mentioned below.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gplc6ho0b6036rwz8uez.png)

2. Now you've landed on EBS Service and click on Create Application
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bejbfrdcb3szop61yyea.png)
 
3. Now we you've to give Application Name and meta-data(Application Tags)

4. During this process we need to give correct platform to run our application. EBS provide some pre-configured AMI[Amazon Machine Image]. Now select Java as platform, Platform branch as Corretto 8 running on 64bit Amazon Linux 2(I'm using  java 8 here) and use Platform version as default one.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tfxhvdg35o9enzlhlaac.png)

5. Click on Upload your code and select Local File.

6. Click On Choose File and select jar which you need to deploy and you can mention application code tags as well if you needed.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ttzzym62uha9q00w8tp2.png)
 
## What happened in the background during EB environment creation?

> During the process we've selected Platform as java and Platform branch as Corretto 8 running on 64bit Amazon Linux 2. So EBS provide preconfigured EC2 instance (Virtual Machine) with java 8 installed with security group having port 80 in inbound rule. In this EC2 instance there is no key-pair is configured so we cant communicate this ec2-instance using different tools like putty, MobaXterm, etc..
 

> Once sg is provisioned then it will associate the elastic ip address to ec2 instance.(Provide static ip address -ip will not change after restart of EC2 instance).

>  If we upload the code the code will be stored in **S3** -Simple Storage Service in AWS(SIMPLE STORAGE like drive) that will deployed as application in instance.

 
Once the application is started you will get an URL under the environment name like this.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fuo2btwn458u8y3dn1xp.png)

Now the application is hosted in AWS Cloud. Now you can use this Application URL to test the Micro services in using API testing tools like Postman, Hoppscotch, ... etc. While testing the application you've to give the URL instead of localhost and port no.
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gto70mvj7c9id7bk5cc7.png)
 
Make sure the you've configured the port no to 5000 in spring boot app.

**Because Elastic Beanstalk always run on port 5000(This is configured by nginx -reverse the request coming from port 80 to 5000).**

**~~THE END~~**