Just as I mentioned in my earlier article - I am a Hard-Core Java/Java EE/Microservices Architect with an overall experience of ~17y. It also includes a book published on Microservices Architecture, with 3 more in the pipeline. Consider to buy my Book on Microservices Architecture : The Decision Maker from Notion Press, Flipkart or Amazon.
For the last about ~4y, I have been working on projects that used the Amazon Web Services (AWS) in some form or the other. But always my involvement was as a Decision Maker on AWS (Discussions/Decisions with DevOps Team on things like ECR, ECS, EKS, K8s on EC2, ...). For the last about 2 weeks, I have been working in this amazing world of AWS Step Functions, AWS API Gateway and AWS Elastic Beanstalk. This time as a Hands-On PoC Developer, not just as a Decision Maker. Absolutely amazed by the power that AWS brings to every aspect of Enterprise Software Development. Elegant Problem Solving with very few errors, bugs, surprises and a large community providing support and sharing their experience.
In this article, we will understand how to move your Spring Boot/REST service and deploy it publicly on the AWS Elastic Beanstalk. In case you have very specific requirements to deploy Java/Java EE on Tomcat, as opposed to a more enterprise virtual server - It is better to go for AWS Elastic Beanstalk. Internally, Elastic Beanstalk may actually be using/provisioning an EC2 instance.
From the Official AWS Documentation.
"AWS Elastic Beanstalk is an easy-to-use service for deploying and scaling web applications and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker on familiar servers such as Apache, Nginx, Passenger, and IIS.
You can simply upload your code and Elastic Beanstalk automatically handles the deployment, from capacity provisioning, load balancing, auto-scaling to application health monitoring. At the same time, you retain full control over the AWS resources powering your application and can access the underlying resources at any time.
Step-By-Step AWS Elastic Beanstalk (Spring Boot/REST)
01. Create your Spring Boot Service using your Favorite IDE like IntelliJ IDEA or Eclipse. Attached Here is the Eclipse Project for the Example Used Here - Buddhahood (Scope is to Generate Random Quotes from The Buddha - Right Now a Single Quote is being Returned as a String).
02. Will be good if you can test out your Spring Boot application locally to check if it compiles and runs fine. It is recommended that you test it using port 5000. Usually 8xxx port series is used for web applications, but 5000 is what is expected by Elastic Beanstalk. Even though, this may be required to be done again, as the server port
03. Keep your Binary (.jar) Ready for Deployment on AWS Elastic Beanstalk. Try to give a friendly or meaningful name, even though it is not necessary.
04. So, Login into your AWS Console and Access 'ElasticBeanStalk'.
07. In the next screen, give the name of your choice for the Application. Also, provide a related Environment Name. You may optionally provide a [Description].
08. Select Managed Platform - You may choose either Java 8 or Java 11 as per your comfort. Keep it in sync with your Spring Boot/REST Application.
1 comment:
Very Nice artical with Proper explaination for Beginers.
Post a Comment