top of page
  • Writer's pictureSubhasish Sahu

How to Deploy SpringBoot Application on to (Serverless)AWS Fargate by pulling images from AWS ECR

Updated: May 30, 2020

Pre - Requisite :

  1. Java 1.8 ( or above)

  2. Intellij Idea IDE

  3. Docker

  4. AWS Account

  5. Docker HUB Account

Create a SpringBoot Application in Intellij IDE

Integrate Docker into your IDE

( For Installing Docker ToolBox ,please refer my previous blog : )

Connect to docker service

From Terminal, run : mvn clean install

Then "Build Image on Docker"


You can Build image as below :

Build successful :

Push Image

You can see the same image got uploaded to Docker Hub

Now the files are available in Docker Terminal also

Before Pushing

After Pushing

Now we need to push those images to AWS ECR, before that we need to create repo in ECR

Now using Docker ToolBox, we will push the image to ECR

First Step is to check if aws cli is available or not :

Command : aws --version

Get the IAM Access Key and Create New Access Key

Configure it with command : aws configure

Connect Docker with AWS ECR

Run the command : aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin <aws account id>

Create a Tag for the image newly build

Command : docker tag springboot_awsfargate:latest <aws account id>

Push image to AWS ECR

Command : docker push <aws account id>

Troubleshooting :

If you get below error

run docker-machine stop default and docker-machine start default

Image pushed to the repository and then click on Permissions to set the permission

Set Permission

The Permission will look something like this

Before creating cluster and running a task, lets create a new Security Group and VPC endpoints

To Create Security Group :

ECR requires two interface endpoints:

  • com.amazonaws.region.ecr.api

  • com.amazonaws.region.ecr.dkr

Endpoint successfully create and running

Goto Account Settings

Create a Cluster


View Cluster

Create Task:

Go Back to ECR and copy the URI

Paste it at the image* textbox

Give Permission to ecsTaskExecutionRole to read image from ECR

After the creation of task , we need to run the task

Create a Service

When you click on the Task,in the next page you will see a Network section ,take the Public IP and hit it in a browser

It means the code has been successfully deployed.Now put the rest of the resource path and you can the proper response from the springboot application

103 views0 comments

Recent Posts

See All
bottom of page