How to Create Cluster Task & Service for Elastic Container Service on Amazon Web Service(AWS).

A task is the instantiation of a task definition within a cluster. After we have created a task definition for application within Amazon ECS, we can specify the number of tasks to run on cluster.

An Amazon ECS service allows we can run and maintain a specified number of instances of a task definition simultaneously in an Amazon ECS cluster.

Create Task


Fig 1


  • Select Launch Type.
  • Select existing Task definitions Family & Revision.
  • Select Cluster.
  • Provide Number of Tasks we want to run on cluster.


Fig. 3


  • Provide Tag key name & value.
  • Click on Run Task.


Fig. 5


  • After sometime Task is running state.


Fig. 4


Create Service

  • Click on Services.
  • Click on Create.


Fig 1


  • Select Launch Type.
  • Select existing Task definition Family & Revision.
  • Select existing cluster.
  • Provide Service name.
  • Select Service type: replica or daemon. Replica scheduling strategy places and maintains the desired number of tasks across cluster.
  • Daemon scheduling strategy deploys exactly one task on each active container instance that meets all of the task placement constraints that specify in cluster.


Fig 2


  • Provide number of Tasks required.
  • Set minimum & maximum healthy percent.


Fig 2


  • We can Add load balancer.


Fig. 4


  • By default load balancer type is none.
  • We can select different type of load balancer on services : application, network or classic.
  • Click on Next step.


Fig. 5


  • By default Auto Scaling is disable.
  • If we needs to auto scaling.
  • Click on Configure Service Auto Scaling.


Fig. 6


  • Provide minimum number of Tasks.
  • Provide Desired & maximum number of Tasks.

Fig. 7


  • Select Scaling policy type.
  • Provide Policy name & Target value.
  • Click on Next step.


Fig. 8


  • Review all configurations.


Fig 9


  • Click on Create Service.


Fig 13


  • New ECS Service created successfully.
  • Click on View service.

Fig 14


  • New ECS service is there with the name we provide.


Fig 10


Create Task & Service using Shell

To Run a Task

aws ecs run-task –cluster <value> –task-definition <value> –count <value>

To Create a service with a Fargate task

aws ecs create-service –cluster Cluster-name –service-name Service-name –deployment-controller type=EXTERNAL –desired-count 1

Leave a Reply