亚马逊AWS官方博客
HAQM Systems Manager Incident Manager 配置指南
概述
HAQM Systems Manager Incident Manager是一个事件管理控制台。事件管理器可以通知用户,突出显示相关的故障以及提供相关工具来使服务恢复正常。 为了帮助用户熟悉如何在亚马逊云平台上使用HAQM Systems Manager Incident Manager,亚马逊工程师开发了以下演示项目供您参考。
整体架构
架构分为四大块:
- HAQM EventBridge
- HAQM Systems Manager Incident Manager
- HAQM Config
- HAQM Chatbot
在本Demo中,我们会创建一个安全组,配置HAQM Config来评估这个安全组。随后我们会添加一条不合规的Inbound Rules,这个安全组的不合规状态会被HAQM EventBridge捕捉到,随即会触发HAQM Incident Manager的响应计划。最后报警信息会被发布到相关聊天频道中,还会通过提升计划以邮件的形式逐层通知到相关人员,同时还会执行运行手册自动地修复不合规的资源,使其达到合规状态。
步骤
在开始之前,请先确保您具有登录AWS 全球区控制台的账号,并具备管理员权限,您可以先登录控制台,选择合适的区域,并保持窗口开启。
一、创建HAQM SNS
请按下面的信息创建SNS。
- Name: IncidentManagerSNS
- Display Name: IncidentManagerSNS
二、创建HAQM Chime并配置Webhook
复制Webhook URL,下一个步骤会使用到。
三、创建HAQM Chatbot
请按下面的信息创建Chatbot,目前HAQM Chatbot支持两种客户端,HAQM Chime和Slack,这里我们以HAQM Chime为例,进行配置。
- Chat client: HAQM Chime
- Name: IncidentManagerChatbot
- Webhook URL: 第二步复制的Webhook URL
- Webhook description: IncidentManagerChatbot
- Role Name: AWSChatbot-role
- Region: Asia Pacific – Singapore
- Topics: IncidentManagerSNS
四、在HAQM VPC中创建用于测试的Security Group
请按下面的信息创建SG。
- Security group name: IncidentManagerTestSG
- Description: IncidentManagerTestSG
- VPC: 默认VPC
五、在HAQM Config中创建Rules
请按下面的信息创建HAQM Config Rules。
- AWS Managed Rules: restricted-ssh
六、创建IAM Role
请按下面的信息分别创建用于HAQM Incident Manager和HAQM Document的IAM Role。
- IncidentManagerRole
- Role name: IncidentManagerRole
- Role description: Allows Incident Manager to call AWS services on your behalf
- Trusted entities: AWS service: ssm-incidents.amazonaws.com
- Policies:
- HAQMSSMFullAccess
- HAQMEC2FullAccess
- IncidentDocumentRole
- Role name: IncidentDocumentRole
- Role description: Allows Document to call AWS services
- Trusted entities: AWS service: ssm.amazonaws.com
- Policies:
- HAQMEC2FullAccess
- AWSConfigRulesExecutionRole
七、在HAQM System Manager中创建Document
选择Create automation,输入“IncidentManagerDocument”,选择Editor,粘贴以下内容,替换assumeRole为第六步创建的IncidentDocumentRole的ARN。
八、在HAQM Incident Manager中创建Contacts
请按下面的信息创建Contact information。
- Name: ope01
- Unique alias: ope01
- Contact channel:
- Type: Email
- Channel name: Email
- Detail: example@example.com
九、在HAQM Incident Manager中创建Escalation plans
Escalation plan可以逐层通知相关联系人,在本指南中只通知了一层联系人,请按下面的信息创建escalation plan。
- Name: escalation01
- Alias: escalation01
- Stage1
- Contact Name: ope01
十、在HAQM Incident Manager中创建Response plans
请按下面的信息创建response plan。
Name: response01
- Title: response01
- Impact: Critical
- Chat channel: IncidentManagerChatot
- Chat channel SNS topics: IncidentManagerSNS
- Engagements: escalation01
- Runbook
- Owner: Owned by me
- Runbook: IncidentManagerDocument
- Version: Default at the time of execuion
- Role name: IncidentManagerRole
十一、在HAQM EventBridge中创建Rule
请按下面的信息创建Rule。
- Name: IncidentManagerRule
选择Event Pattern,Custom pattern,粘贴以下内容,替换GroupId为第四步中创建的Security Group Id。
- Target
- Incident Manager response plan
- Reponse plan: response01
测试验证
一、添加Inbound Rules
请按以下信息往本指南中创建的SG里添加一条Inbound Rule。
- Type: SSH
- Source: Anywhere-IPv4
二、告警检查
- Incident Manager检查,已成功报警。
- HAQM Chime检查,已成功报警。
- HAQM System Manager Automation检查,已成功执行。
- Security Group检查,不合规的Inbound Rule已被删除。