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.
Search and open Elastic BeanStalk Service in AWS as mentioned below.
Now you've landed on EBS Service and click on Create Application
Now we you've to give Application Name and meta-data(Application Tags)
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.
Click on Upload your code and select Local File.
Click On Choose File and select jar which you need to deploy and you can mention application code tags as well if you needed.
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.
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.
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
Top comments (0)