5
votes

Based on amazon docs:

An Amazon ECS cluster is a logical grouping of tasks or services. If you are running tasks or services that use the EC2 launch type, a cluster is also a grouping of container instances. If you are using capacity providers, a cluster is also a logical grouping of capacity providers. When you first use Amazon ECS, a default cluster is created for you, but you can create multiple clusters in an account to keep your resources separate.

In our use case, we are not using EC2 launch types. We are mainly using Fargate.

What are the usual basis/strategy on grouping services? Is it a purely subjective thing?

Lets say I have a Payment Service, Invoice/Receipt Service, User Service, and Authentication Service. Do I put some of them in an ECS cluster or is it best practice to have them on separate ECS clusters.

1

1 Answers

4
votes

A service is a functioning application, so for example you might have an authentication service or payment service etc.

Whilst services can speak between one another, a service by itself should contain all parts to make it work, these parts are the containers.

Your service may be as simple as one container, or contain many containers to provide its functionality such as caching or background jobs.

The services concept generally comes from the ideas of both service driven design and micro service architecture.

Ultimately the decision comes down to you, you could put everything under one service, but this could lead to problems further down the line.

One key point to note is the scaling of containers is done at a service levels so you would need to increase all containers that are part of your task definition. You generally want to scale to meet the demands of functionality.

An ECS Cluster may contain one service or contain a number of services that produce a deliverable. For example in AWS S3 is made up of more than 200 micro services, these would be a cluster. However you would not expect every AWS service to be part of the same cluster.

In your scenario you define several services, personally I would separate these into different clusters as they deliver completely different business functions.