Increase Timeout for ECS Service Rolling Update | AWS Certified DevOps Engineer Exam

Increase Timeout for ECS Service Rolling Update

Prev Question Next Question

Question

You use an ECS cluster to host a web application with an Application Load Balancer.

You also build a pipeline to perform the rolling update of the ECS service using the AWS ECS CLI command “ecs-cli compose”

Everytime when you update the ECS service with a new task, it takes 5 minutes for the old ECS task to drain the connections before the task is stopped.

There is a requirement to increase the timer to 10 minutes.

How would you achieve this requirement?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer - C.

Option A is incorrect because the draining timeout cannot be configured in the AWS ECS service console.

Instead, the timer is controlled by theDeregistration delay in the target group.

Option B is incorrect because the Application Load Balancer itself does not determine the draining timeout.

You should check the Deregistration delay value configured in the target group.

Option C is CORRECT because the Deregistration delay value determines the connection draining timeout for a rolling update in the relevant ECS service.

Its default value is 300 seconds and should be adjusted to 600 seconds.

Option D is incorrect because the ECS CLI command “ecs-cli compose” does not have the option “--Deregistration delay”

The draining timeout should be configured in the target group.

Reference:

https://aws.amazon.com/premiumsupport/knowledge-center/ecs-tasks-stop-delayed-draining/, https://docs.amazonaws.cn/en_us/AmazonECS/latest/developerguide/container-instance-draining.html

The correct answer is C: Find the target group of the Application Load Balancer used by the ECS cluster and check the value of Deregistration delay. Increase the value to 600 seconds (10 minutes).

Explanation:

When an ECS task is stopped or terminated, the connections to the task are gradually drained before it is deregistered from the load balancer. The default value for the connection draining timeout in Amazon ECS is 300 seconds or 5 minutes. This means that when you update the ECS service with a new task, it takes 5 minutes for the old ECS task to drain the connections before the task is stopped.

To increase the connection draining timeout to 10 minutes, you need to modify the value of the Deregistration delay for the target group associated with the Application Load Balancer used by the ECS cluster. The Deregistration delay is the amount of time, in seconds, that the load balancer waits before it deregisters a target after it receives a deregistration request.

Option A is incorrect because the timeout for connection draining cannot be modified from the Deployment tab of the ECS service in the AWS Console.

Option B is incorrect because the default draining timer of the Application Load Balancer cannot be modified from the AWS Console.

Option D is incorrect because the option "Deregistration delay" is not available in the "ecs-cli compose" command.

Therefore, Option C is the correct answer. To modify the value of the Deregistration delay for the target group, you can follow these steps:

  1. Go to the Amazon EC2 Console and select the target group used by the Application Load Balancer.
  2. Click on the Edit button to modify the target group settings.
  3. In the Health checks section, modify the Deregistration delay to 600 seconds (10 minutes).
  4. Click on the Save button to save the changes.

After modifying the value of the Deregistration delay, the connection draining timeout for the ECS tasks will be increased to 10 minutes.