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
gefragt vor einem Jahr659 Aufrufe
1 Antwort
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
beantwortet vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen