AWS Beanstalk :
Do you want to deploy your applications (Java, .NET, Node JS) in AWS cloud easily? Then the best way is to go for Beanstalk.
Just upload your application like JAR file if Java application, and create application. Beanstalk automatically provision all required resources and deploy them, and provides the URI to access the application. It is very fast deployment without struggling defining your EC2, Scaling, Load balancing configuration and you can have full control on created resources like EC2 instances etc.,
Deploy via AWS Console:
Pre-requisites:
- Have your application built and ready. In my case a simple Spring Boot application with REST API end points. Please do-not provide SERVER.PORT:8080 and leave it to default.
- Test your application locally using, java -jar app.jar and test it is working fine.
- Have your AWS account and credentials. Login to AWS Console.
- Check if you have VPC ready, if you do not have, please create a default VPC.
Step to Deployment:
- Login to AWS Console, Search for Elastic Beanstalk and click.
- Click the create environment button.
- Choose web server environment as our app is web API, and click SELECT button.4
- In the application details page
- Fill Application Name : example java-balaji-api
- Fill Environment Name : example: java-balaji-api-dev
- Provide description
- Choose Platform, here in our case it is Java Spring Boot based API so selected Java
- Choose Platform Branch : My app is built using OpenJDK 11, so I selected "Corretto 11 running on 64 bit Amazon Linux2"
- Platform Version : I chosen default Recommended
- Application Code Tab: Select Upload your code.
- Fill Version and Choose Local file, and upload the jar from local folder location.
- Configure More Options
- Click Software and Edit button
- In Environment properties, please add new variable and value SERVER_PORT and value 5000.
- Then click Save button
- Then Click create application.
Test from Postman:
Terminate and Remove:
If you want to terminate the application, please choose and terminate. It will terminate only the EC2 instance. But to remove your application from S3, please click application and click "Delete" button.