ECS clusters in AWS

Some important points about ECS Clusters

  • ECS clusters is logical grouping of EC2 instances.
  • These EC2 instances run the ECS agent(Docker container) to use ECS service.
  • Once the ECS agent is up , it registers the instance with the ECS clusters.

ECS Architectures

There are two types of Architectures we can use when we think of having an ECS cluster

Public and Public/Private

ECS Setup
IAM roles–It’s good to create these roles yourself before creating a ECS cluster otherwise they will be created automatically and you might not know what role is used for what purpose
  • EC2 Role: This allows ECS agent on the EC2 hosts to communicate with ECS and ECR
  • ECS Role : This role authorizes ECS to manage resources on your behalf
  • ECSTaskExecutionRole:This role is attached to the ECS tasks
  • AutoscalingRole : Used to allow AWS Autoscaling to inspect sats and adjust scalable targets

So we have created the following roles as per our description given above:

Creating the core Infrastructure
  • VPC
  • Subnets
  • Internet Gateways

VPC: I have created the following VPC in the my AWS console

Subnets: I have also created two subnets both in different Availability zones

Internet Gateway: Then last but the not the least , i have created an Internet Gateway as well .

ECS Cluster creation via AWS management Console

Once all the pre-reqs have been met, we will launch our ECS cluster in AWS . I am selecting the EC2 Linux cluster as given in the screenshot below:

  • Step 1 is creating a cluster with the EC2 instance selected.
  • Step 2 is to configure your cluster where to keep the costs down i have selected a T2 small instance.
  • Step 3 in Networking you can see the screenshot below , i have selected the VPC i created , i selected my subnets in different availability zones and i am creating a new security group.
  • Step 4 is selecting your IAM instance creating role that we created earlier.
  • Step 4 Once you have done all these steps you can click on creating the ECS cluster.

Once everything is done you will get the following screen , and as you can see you will also get a cloud formation template created for you.

We can see our cluster and can clearly see the EC2 instance which is available for us to run the containers .


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Website Powered by

Up ↑

%d bloggers like this: