Use CloudWatch Events to report ECS Task status to Slack

Tram Ho

Hello everyone today, I would like to introduce the article about using Cloudwatch Events to notify Slack when the AWS ECS task has problems.

  • What is CloudWatch Events?

    When using CloudWatch Events, you will define an event pattern for an AWS resources. Accordingly, when that resource acts like in the pattern we have defined, the trigger will be activated. Today I will introduce using Lambda to send a message to Slack to notify when the ECS task is Stopped for a certain reason (Maybe healthcheck Load Balancer failed, because the user intentionally stopped the ECS task, …)

  • General structure
  • handler.js

  • serverless.yml

  • Deploy

  • Kiểm TRA

    Try to stop ECS task to see if the message is back !!

Thank you for reading here. If you have any questions, please comment below the post I will answer within my understanding. See you in the next post !!!

Share the news now

Source : Viblo