Creating the Amazon ECS Cluster and Task using the console
In this article, we will understand the high-level view of ECs and will do some basic stuff, that is to create the ECS Cluster and tasks using the console
- Cluster : Logical grouping of tasks or services.
- Service : It defines, runs and maintains the tasks
- Task : A running Container or A task is the instantiation of a task definition within a cluster.
- ECS Container Agent : It allows container instances to connect to the Cluster.
Step 1: Creating Clusters
The first step is to create a Cluster. Goto ECS > Create Cluster >>Choose EC2 Linux + Networking, Since we are demonstrating the EC2 Type.
Choose Cluster Name(Any name), Instance Type(t2.micro to keep the cost as lowest as possible), Keypair(use existing pair), specify the number of tasks(2)>> Create Cluster
After my cluster is created, I will have the below output
Step 2: Creating Services and Tasks
Now let's create a service and add tasks to the cluster. Click Service > Create Service. When you will go through the step of creating the Service, choose
Any desired name
Launch Type: EC2
Any desired Service name
Number of task: 2
Choose existing Cluster VPC and Subnets
After you are done creating the service the dashboard will look like this:-
If I go to my Cluster and Service I see the below result :
Under Task, we see 2 tasks since we mentioned the number of tasks as 2, For me, the default name was picked by the AWS console as Fargate-Task even when I selected ec2 type.
if we click on our instances, we find they do not have the public IP. To connect them we have to go privately or we would need NAT Instances or Load Balancer for inbound traffic.
As a result, we are able to accomplish our goal. Do not forget to clean up to avoid any charges💰
Thanks for reading and Keep Pushing!!