Increase the ECS Service Update Timer | AWS Certified DevOps Engineer - Professional | Exam DOP-C01

Increase ECS Service Update Timer

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 a new ECS task is deployed, the Application Load Balancer (ALB) starts to route traffic to the new task and gradually reduces the traffic to the old task. This process is known as connection draining. By default, the ALB waits for 5 minutes before terminating the old task after it has drained all the connections. However, in this scenario, the requirement is to increase this timer to 10 minutes.

Option A is incorrect because the ECS service in the AWS Console does not have a direct setting for connection draining timeout. It only displays the status of the deployment and allows you to modify the desired count of tasks.

Option B is incorrect because modifying the default draining timer of the ALB affects all target groups, not just the one used by the ECS cluster. This could cause issues with other applications that use the same ALB.

Option D is incorrect because the "--Deregistration delay" option is not a valid option in the ECS CLI command "ecs-cli compose". This option is used in the AWS CLI command "aws elbv2 modify-target-group-attributes" to modify the deregistration delay of a target group.

Therefore, the correct option is C. To increase the timer for connection draining in this scenario, we need to find the target group used by the ALB of the ECS cluster and modify its "Deregistration delay" value to 600 seconds (10 minutes). This can be done by performing the following steps:

  1. Open the Amazon EC2 console.
  2. In the navigation pane, choose "Target Groups".
  3. Select the target group used by the ALB of the ECS cluster.
  4. Choose the "Attributes" tab.
  5. In the "Target group attributes" section, locate the "Deregistration delay" attribute.
  6. Click the "Edit" button and increase the value to 600 seconds (10 minutes).
  7. Click the "Save" button to save the changes.

After modifying the "Deregistration delay" value, the ALB will wait for 10 minutes before terminating the old task after it has drained all the connections. This allows the ECS service to perform a rolling update with a longer connection draining time.