Monitoring ECS task scale-in protection

0

Hi,

I wanted to understand if there is a way we can monitor the ECS scale-in events and which tasks were able to bypass the scale-in event due to being protected at that time. The official article does not include any information regarding this.

Ashwani
已提问 2 个月前559 查看次数
2 回答
1

The task scale-in events are managed by the Application Auto Scaling service. You can monitor these events using Amazon EventBridge, as described in this documentation.

Regarding tasks that are protected during a scale-in event, there is currently no direct way to retrieve this information, and no dedicated metric is available. However, you can retrieve the Task Protection status either from the Amazon ECS container agent endpoint or through the GetTaskProtection Amazon ECS API.

To address your requirements, you can implement a logic (AWS Lambda) that will be triggered by Amazon EventBridge whenever a scale-in event occurs. This logic should call the GetTaskProtection API for all running tasks to determine which tasks currently have the Task Protection status enabled.

I recommend opening an issue in the GitHub Containers Roadmap and providing your use case. This will allow the AWS team to consider implementing a dedicated Task Protection status metric that can be published automatically to Amazon CloudWatch.

profile pictureAWS
已回答 2 个月前
0

To monitor ECS scale-in events and which tasks were able to bypass due to being protected:

  • You can check the CloudWatch logs for the ECS service to see scale-in events that occurred. This will show the desired count being reduced.
  • To see which specific tasks were protected, you can use the describe-tasks AWS CLI command to get the protection status of each task:
aws ecs describe-tasks --cluster mycluster --tasks TASK_ID1 TASK_ID2
  • The output will include a protectionStatus field indicating if the task is protected or unprotected.
  • You can also enable CloudWatch container insights on your ECS tasks to get metrics on task protections set/cleared through the ECS agent endpoint. This provides visibility into which tasks are setting themselves as protected.
  • For tasks using the ECS API to set protection, you would need to integrate your application logs with CloudWatch to correlate scale-in events with protection calls made through the API.
profile picture
专家
已回答 2 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则