Skip to content

ArthuR1CP/java-web-ga

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Boot Maven App with AWS Elastic Beanstalk

🚀 Project Overview

This is a Spring Boot application built with Maven, designed to run on AWS Elastic Beanstalk. It is configured to use Java 17 (Corretto) and supports automatic deployment via GitHub Actions.


🔧 Prerequisites

Ensure the following are installed on your system:

  • Java 17 (OpenJDK or Corretto 17)
  • Maven (for building and running the app)
  • AWS CLI (for AWS Elastic Beanstalk management)
  • EB CLI (for managing Beanstalk environments)
  • cURL (for API testing)

🚀 Running the Application Locally

1️⃣ Clone the Repository

git clone https://github.com/ArthuR1CP/python-flask-ga.git
cd your-repo-name

2️⃣ Build the Project with Maven

mvn clean package

3️⃣ Run the Application

By default, the application runs on port 5000:

mvn spring-boot:run

4️⃣ Test the API Locally Using cURL

✅ Create a User (POST)

curl -X POST http://localhost:5000/users      -H "Content-Type: application/json"      -d '{"name": "Artur Cepuc", "email": "arturcepuc@gmail.com"}'

✅ Get All Users (GET)

curl -X GET http://localhost:5000/users

✅ Get User by ID (GET)

curl -X GET http://localhost:5000/users/1

✅ Delete a User (DELETE)

curl -X DELETE http://localhost:5000/users/1

🌍 Testing on AWS Elastic Beanstalk

Once deployed, replace your-app-name with your AWS Elastic Beanstalk app URL:

curl http://your-app-name.eu-west-3.elasticbeanstalk.com/users

🚀 Deploying to AWS Elastic Beanstalk

1️⃣ Set AWS Credentials in GitHub Secrets

Go to GitHub → Your Repo → Settings → Secrets → Actions, then add:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY

2️⃣ Push Code to GitHub

Pushing to the main branch triggers GitHub Actions to deploy the app:

git add .
git commit -m "Deploy app to AWS Elastic Beanstalk"
git push origin main

3️⃣ Monitor Deployment in GitHub Actions

Check GitHub → Actions for the deployment status.


📘 Summary

  • Run Locally: mvn spring-boot:run & test with curl
  • AWS Deployment: GitHub Actions deploys the app automatically.
  • Test API: Use curl to interact with the API locally or on AWS.

🚀 Now you're ready to build, test, and deploy your Spring Boot app! 🎉

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors