Post a Slack notification to a channel when an AWS ECS task goes into an unexpected STOPPED status.
-
Create a AWS Lambda function named
ecs-deploy-watchguardusing the Node.js 12.X runtime. Set the basic setting timeout to something reasonable like10 secondsfrom the default to allow for Slack API slowness. -
Create a webhook in Slack and set the environment variable
SLACK_WEBHOOK_URLin the AWS Lambda function. -
Navigate to CloudWatch and then to
Events => Rules. Create a new rule with the following:
