Create a cloudwatch alarm if my running count in ecs service is 0

0

I have an ecs cluster with fargate as launch type and one service which has desired count as 1.

In somecase all my task may stop and there may a bug in the last updated code , hence the task will be created and deleted frequently. If this scenario happens I need to get notified. The desired count would be 1 , but the task keeps on deleting and creating as there may be any scenario that stops the container.

Bhavesh
질문됨 일 년 전657회 조회
1개 답변
0

You can use the Task state change events to send an alarm whenever the task changes its state to stopped.

You can use the AWS Event Bridge rule below:

{
  "source": ["aws.ecs"],
  "detail-type": ["ECS Task State Change"],
  "detail": {
    "lastStatus": ["STOPPED"]
    "clusterArn": ["$CLUSTER_ARN"]
  }
}

It will catch all stopped task events from the cluster provided. Please change the $CLUSTER_ARN with the respective cluster ARN.

I hope this helps you!

profile pictureAWS
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠