1 Answer
- Newest
- Most votes
- Most comments
2
Hello.
I have created a CloudFormation like the one below in the past.
This template uses EventBridge to retrieve AWS health dashboard events and send them from AWS Chatbot to Slack via Amazon SNS.
AWSTemplateFormatVersion: "2010-09-09"
Description: aws-health-check-chatbot
Parameters:
SlackWorkspaceId:
Type: String
Default: ""
SlackChannelId:
Type: String
Default: ""
Resources:
# IAM role
HealthCheckIAMloreChatbot:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service:
- chatbot.amazonaws.com
Action:
- "sts:AssumeRole"
Policies:
- PolicyName: policies
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Action:
- cloudwatch:Describe*
- cloudwatch:Get*
- cloudwatch:List*
Resource: "*"
# AWS Chatbot
HealthCheckChatbotConfiguration:
Type: AWS::Chatbot::SlackChannelConfiguration
Properties:
ConfigurationName: HealthCheckChatbotConfiguration
GuardrailPolicies:
- arn:aws:iam::aws:policy/AdministratorAccess
IamRoleArn: !GetAtt HealthCheckIAMloreChatbot.Arn
SlackChannelId: !Ref SlackChannelId
SlackWorkspaceId: !Ref SlackWorkspaceId
SnsTopicArns:
- !Ref HealthCheckSNSTopic
# EventBridge
HealthCheckEventBridgeRule:
Type: AWS::Events::Rule
Properties:
Name: HealthCheckEventBridgeRule
EventPattern:
source:
- aws.health
detail-type:
- AWS Health Event
Targets:
- Arn: !Ref HealthCheckSNSTopic
Id: sns-topic
# SNS topic
HealthCheckSNSTopic:
Type: AWS::SNS::Topic
Properties:
TopicName: HealthCheckSNSTopic
HealthCheckTopicPolicy:
Type: AWS::SNS::TopicPolicy
Properties:
PolicyDocument:
Statement:
- Sid: AllowServices
Effect: Allow
Principal:
Service:
- events.amazonaws.com
Action: "sns:Publish"
Resource:
- !Ref HealthCheckSNSTopic
Topics:
- !Ref HealthCheckSNSTopic
Relevant content
- Accepted Answer
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
By the way, if messages are not sent from SNS to Chatbot, the troubleshooting method in the document below may be helpful. https://repost.aws/knowledge-center/sns-aws-chatbot-message-troubleshooting