Vip
Vip

Reputation: 1616

Running single task in ECS without Blue/Green Deployment

Is it possible to have exactly one task running in AWS ECS at all time? I don't want to have Blue/Green kind of deployment.

My Requirement:

Min/Desired/Max task = 1;

When I redeploy ECS service, then it should first stop old task and then spin new task. Currently it does opposite.

Any reference would be helpful.

Upvotes: 2

Views: 1237

Answers (1)

Prashant
Prashant

Reputation: 256

Yes it is possible.

You can create an ECS Service with Number of Tasks as 1 that will set the desired count to 1.

Since you want only 1 task and that should stop and then a new one should come, you can modify the Deployment Configuration with below values:

Minimum Healthy Percent - 0

Maximum Percent - 100

With Desired Count as 1, Minimum Healthy Percent as 0 and Maximum Percent as 100, ECS Service will kill the already running task and then create a new task.

Note: Service will de down during this time.

To explain the behavior you noticed, The default values are

Minimum Healthy Percent - 100

Maximum Percent - 200

and with Desired Count as 1, in this case ECS Service will maintain one running task at all times since Minimum Healthy Percent is 100 i.e. 100% of 1 is 1. However, Maximum Percent as 200 allows ECS Service to create another task as 200% of 1 is 2. So a new task is started first and once this task is stable the old task is stopped.

Upvotes: 6

Related Questions