Deploy a Spring Boot Application with AWS
Last Updated :
23 Jul, 2025
A spring boot application is a Java-based web application that is built using the Spring Boot framework. Spring Boot is a project designed to simplify the development and deployment of production-ready Java applications.
Creating a Spring Boot Project with Spring Initializr: Step-by-Step Guide
Note : If you already have a spring boot application ,you can skip these steps.
Step 1 : Go to spring initializr to quickly bootstrap a simple spring boot web application.
-768.png)
Please note that I have included only one dependency, which is Spring Web, as you can see from the screenshot above.After filling all details and selecting web dependency, click on Generate or ctrl + Enter.The zipped project will be downloaded in your system.
Before deploying the application, it is essential to configure your AWS account and set up the necessary tools, such as the AWS CLI (Command Line Interface). Understanding these tools will allow you to deploy your applications efficiently.
For a deeper dive into mastering AWS services for deployment and more advanced Spring Boot integrations, consider exploring this comprehensive AWS Cloud Course. It provides hands-on experience with AWS, including practical exercises on deploying Spring Boot applications.
Step 2 : Unzip the downloaded project and import it in your IDE. I'll use VS Code for it.

Step 3: Adding a RestController to test our project.
Go to src > main > com > example > demo
src > main > com > example > demo
Note: You may have different names after com . If different project and package names are specified .
Now create a new file named TestController.java beside DemoApplication.java file.

We will create a basic controller with minimal code and endpoint to "/."
Java
package com.example.demo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class TestController {
@GetMapping("/") public String health()
{
return "Hello Geeks And Welcome to GeekForGeeks !!!";
}
}
Note : The load balancer for Elastic Beanstalk by default utilizes path "/" for health checks. Your application will keep failing health checks and display Severe status in the dashboard if that path is not defined in your controller. Either include a "/" endpoint in your rest controller code, or later change the load balancer setting to utilize an alternate path.

Step 4: Test the Application locally .Just click on Run Java Button on top right on the VS Code.Now , go to browser and open localhost:8080 . It will show like

So, our application is running properly.
Step 5: Prepare the final Jar file
Open the terminal and type (maven) mvn package to build a jar file

After successful execution it will show like this

Once your build is successful, you will find the jar file in target folder. Copy the jar file and keep it in your system safely.
How to deploy our Spring Boot Application on AWS?
There are multiple ways to deploy Spring Boot application on AWS. In this example, we will deploy a Spring Boot application on AWS Elastic Beanstalk, which is a Platform as a Service (PaaS) offering that simplifies the deployment and scaling of web applications. Elastic Beanstalk supports Java applications, making it a suitable choice for Spring Boot.
Step 1: Open AWS Console and Create and Elastic BeanStalk Application
An application is a top-level container in Elastic Beanstalk that contains one or more application environments .So, let’s create an application.Click on Create Application

Provide Application name and Application Tags(Optional).

Step 2: Scroll Down and Provide the below information :

Step 3: In Application Code , Select upload your Code :Give a Version Label, and select Local File and select the jar file saved earlier.

and click on NEXT .
Step 4: Configure Service Access.Select existing service role as aws-elasticbeanstalk-service-role

Select your EC2 key pair and EC2 instance profile to securely log in to your EC2 instances.
-660.png)
Now Click on Skip to Review ,
Step 5: Adding Environment Variable
Make Sure to add SERVER_PORT and JAVA_HOME values as
SERVER_PORT 5000
and java_home variable as,
JAVA_HOME /ur/lib/jav/java
after setting the environment variables , it will look like

Now Click On Submit.
Step 6: As soon as you click Submit.Elastic Beanstalk starts setting up your application environment. It will take few minutes , After completion the dashboard will look like this

Upon clicking on the link under domain ,we will be directed to our deployed app,
Our Spring Boot Application is Deployed on AWS Elastic Beanstalk successfully.
Similar Reads
DevOps Tutorial DevOps is a combination of two words: "Development" and "Operations." Itâs a modern approach where software developers and software operations teams work together throughout the entire software life cycle.The goals of DevOps are:Faster and continuous software releases.Reduces manual errors through a
7 min read
Introduction
What is DevOps ?DevOps is a modern way of working in software development in which the development team (who writes the code and builds the software) and the operations team (which sets up, runs, and manages the software) work together as a single team.Before DevOps, the development and operations teams worked sepa
10 min read
DevOps LifecycleThe DevOps lifecycle is a structured approach that integrates development (Dev) and operations (Ops) teams to streamline software delivery. It focuses on collaboration, automation, and continuous feedback across key phases planning, coding, building, testing, releasing, deploying, operating, and mon
10 min read
The Evolution of DevOps - 3 Major Trends for FutureDevOps is a software engineering culture and practice that aims to unify software development and operations. It is an approach to software development that emphasizes collaboration, communication, and integration between software developers and IT operations. DevOps has come a long way since its in
7 min read
Version Control
Continuous Integration (CI) & Continuous Deployment (CD)
Containerization
Orchestration
Infrastructure as Code (IaC)
Monitoring and Logging
Microsoft Teams vs Slack Both Microsoft Teams and Slack are the communication channels used by organizations to communicate with their employees. Microsoft Teams was developed in 2017 whereas Slack was created in 2013. Microsoft Teams is mainly used in large organizations and is integrated with Office 365 enhancing the feat
4 min read
Security in DevOps