This is an example of how to send CloudWatch alarms to a Microsoft Teams channel. Check out the blog post on marbot.io to learn more.
One thing before we go any further. You should check out our chatbot marbot for Microsoft Teams as a more advanced solution to monitor your AWS account. You will love the following features: deduplication of alarms, quick links pointing to the right places on the AWS Management Console, escalation with direct messages, and many more.
- Open the channel in Microsoft Teams that you want to send CloudWatch alarms to.
- Create a new connector of type
Incoming Webhook
for the channel. - Copy the webhook URL.
- Clone or download this respository
- Select a region:
export AWS_REGION=us-east-1
. - Choose a unique suffix (replace
$UniqueSuffix
with e.g. your domain/username):export SUFFIX=$UniqueSuffix
. - Create a S3 bucket for SAM:
aws s3 mb s3://cw-to-teams-${SUFFIX}
- Install Node.js dependencies:
npm install
- Package the Lambda function code:
aws cloudformation package --s3-bucket cw-to-teams-${SUFFIX} --template-file template.yml --output-template-file template.sam.yml
- Deploy the CloudFormation stack (replace
$WebhookURL
with your URL from Microsoft Teams):aws cloudformation deploy --parameter-overrides "WebhookURL=$WebhookURL" --template-file template.sam.yml --stack-name cw-to-teams --capabilities CAPABILITY_IAM