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 個月前檢視次數 561 次
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 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南