Java Spring Boot Docker AWS EKS Deployment Tutorial |Video upload date:  · Duration: PT1M0S  · Language: EN

Step by step guide to build a Java Spring Boot app Dockerize push to Amazon ECR and deploy to AWS EKS with practical tips

Overview

Ready to take a Spring Boot jar and make it suffer through a full cloud dream sequence You will build the artifact package it into a Docker image push that image to Amazon ECR provision an EKS cluster and let Kubernetes do its thing while you sip something caffeinated This guide keeps the steps practical and a little sarcastic while staying accurate

Build the Spring Boot artifact

Use Maven or Gradle to create a runnable jar that will be the thing inside your container You do not need wizardry just a reliable build

mvn clean package
# or
gradle build

Grab the produced jar from target or build libs This is your deliverable for the container stage

Create a Docker image

Keep the Dockerfile minimal and predictable Use an OpenJDK base copy the jar and set the entry point

FROM openjdk 11 jre
COPY target myapp jar
ENTRYPOINT java -jar myapp jar

Build the image locally and test it before touching cloud registries

docker build -t myapp .
docker run --rm -p 8080 8080 myapp

Publish the image to Amazon ECR

Create a repository authenticate Docker with AWS and push the image The AWS CLI will do the heavy lifting

aws ecr create-repository --repository-name myapp
aws ecr get-login-password | docker login --username AWS --password-stdin 123456789012.dkr.ecr.us east 1.amazonaws.com
docker tag myapp 123456789012.dkr.ecr.us east 1.amazonaws.com/myapp
docker push 123456789012.dkr.ecr.us east 1.amazonaws.com/myapp

Use your account id and region Replace placeholders carefully and ensure your IAM user can push images

Prepare an EKS cluster and configure kubectl

Provision a cluster with eksctl or the AWS console If you use eksctl the command is simple and forgettable in a good way

eksctl create cluster --name my cluster --region us east 1 --nodes 2

Then tell kubectl which cluster to talk to

aws eks update kubeconfig --name my cluster --region us east 1

Make sure the node group can pull from ECR either by using an instance role that has the ECR pull policy or by attaching the right permissions at creation time

Apply Kubernetes manifests to deploy the app

Create a Deployment and Service manifest that reference the ECR image Use readiness and liveness probes for production safety Then apply the manifests

kubectl apply -f deployment yaml
kubectl apply -f service yaml
kubectl get pods --watch

Wait for pods to reach ready state and check logs if something smells wrong

Test and scale the deployment

Expose the service using a LoadBalancer type or an ingress depending on your cluster setup Hit the app with a few requests and observe behavior

  • Scale manually with kubectl scale to simulate load
  • Enable Horizontal Pod Autoscaler to let Kubernetes handle surges
  • Use kubectl describe and kubectl logs to troubleshoot
kubectl scale deployment my app --replicas 5
kubectl autoscale deployment my app --min 2 --max 10 --cpu percent 80

Quick checklist for a non tragic deploy

  • Build artifact with Maven or Gradle
  • Use a small and reproducible Dockerfile
  • Push image to ECR with correct permissions
  • Provision EKS and update kubeconfig
  • Apply manifests and use probes
  • Test scaling and set up autoscaling if needed

Recap and parting truth

You just moved a Spring Boot jar into a container registry and told Kubernetes to run it in AWS EKS That is the core workflow CI CD pipelines and more advanced security like IRSA or private registries are next level topics but the basics will get traffic flowing and give you something to blame when things go sideways

Remember to automate the repetitive bits with your CI CD system and keep an eye on logs metrics and permissions Happy deploying and may your pods stay ready

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.