Introduction

When you decide to deploy microservices on Amazon ECS, you will have to use AWS Fargate. The advantage of using AWS Fargate is that it offers scalability along with flexibility for your containerized applications. In order to deploy the Java microservices on ECS using Fargate, we will be taking help of the following two approaches.

Approach 1: Docker Hub Deployment

Prerequisites

Architecture

Source Technology Stack

Source Architecture

Target Technology Stack

Target Architecture

Tools

Dockerfile

FROM openjdk:11penjdk:11

ADD target/Spring-docker.jar Spring-docker.jar

EXPOSE 8080

ENTRYPOINT ["java","-jar","Spring-docker.jar"]

Epics

Creating New Task Definitions

Configure the Cluster

Run the Task

Approach 2: Amazon ECR and Fargate Deployment

Prerequisites

Architecture

Source Technology Stack

Source Architecture

Target Technology Stack

Target Architecture

Tools

Dockerfile

FROM openjdk:8

ADD target/Spring-docker.jar Spring-docker.jar

EXPOSE 8080

ENTRYPOINT ["java","-jar","Spring-docker.jar"]

Epics

Creating an Amazon ECR Repository

Create and Spin Up the Container

Create an ECS Cluster and Configure a Service

Conclusion

All in all, if you want a robust solution for containerized applications then you have to deploy the Java microservices on Amazon ECS using AWS Fargate. It doesn’t matter which approach you use (pulling an image from Docker hub or using Amazon ECR), both of them will offer you ease in deployment, scalability and manageability. It is up to you which approach you use depending upon your requirements. Here is the detailed AWS Re-invent Talk on Deployment of microservices using AWS Fargate 

Leave a Reply

Your email address will not be published. Required fields are marked *