Home > OS >  How to start up ECS services in a sequences?
How to start up ECS services in a sequences?

Time:09-03

I have 3 ECS containers: A, B and C.

Start up time:

  • A: 2mins
  • B: 1min
  • C: 10sec

C depends on B and B on A.

How do I go about starting them in a sequence?

https://github.com/aws/containers-roadmap/issues/123 - doesn't help me as the containers need to be in one Task Definition which means I can't scale independently.

I tried just doing this but each line is not related to the previous one. So container B can start before container A.

aws ecs update-service --region us-east-1 --cluster clusterName --service serviceA --force-new-deployment
aws ecs update-service --region us-east-1 --cluster clusterName --service serviceB --force-new-deployment
aws ecs update-service --region us-east-1 --cluster clusterName --service serviceC --force-new-deployment

CodePudding user response:

You can do this by adding a wait between each of your update calls:

aws ecs update-service --region us-east-1 --cluster clusterName --service serviceA --force-new-deployment
aws ecs wait services-stable --region us-east-1 --cluster clusterName --services serviceA 
aws ecs update-service --region us-east-1 --cluster clusterName --service serviceB --force-new-deployment
aws ecs wait services-stable --region us-east-1 --cluster clusterName --services serviceB
aws ecs update-service --region us-east-1 --cluster clusterName --service serviceC --force-new-deployment
  • Related