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
feita há um ano656 visualizações
1 Resposta
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
respondido há um ano

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas