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
preguntada hace un año657 visualizaciones
1 Respuesta
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 hace un año

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas