An ECS Fargate cluster consists of several essential components.

First, container instances serve as the compute resources, responsible for running containers and executing tasks within the cluster.

Task definitions, define how containers should be configured, including resource requirements and networking settings.

Tasks represent running instances of containerized applications, while services enable managing long-running applications, handling scaling, load balancing, and task recovery.

Load balancers distribute incoming traffic across multiple tasks for high availability and scalability.

In this article, we will explore how we should set up those cluster components to create an efficient and effective deployment.

ECS Cluster basic components
ECS Cluster basic components

Setting Up ECS Cluster

Let’s start with the ECS cluster, Navigate to Elastic Container Service, choose clusters and press Create a cluster.

Cluster VPC / Networking Configuration

Here in this infrastructure, we have components that should be deployed on both public and private subnets. Hence choose the VPC and all the subnets under that VPC.

VPC Cluster Networking configurations
VPC Cluster Networking configurations

Infrastructure Configurations

Here we can choose how our infrastructure should be placed between,

  • Fargate – Default and Pay-as-you-go configuration. (Serverless) – We choose fargate.
  • EC2 Instances – Manual configurations.
  • External EC2 instances using ECS anywhere

Then press Create with other default configurations.

ECS Cluster created successfully
ECS Cluster created successfully

Conclusion

Now we have completed setting up the ECS cluster which will be the base for our ECS fargate deployment.

Let’s focus on creating Task definitions where we configure how the containers should be deployed in our next article.

Source Code and Other Resources

All the necessary source codes are committed to this GitHub repository and the postman collection for the testing can be found under this link

Comment your thoughts or any issues found while proceeding with this article series.

Happy coding.