

# OPS10-BP07 自动响应事件
<a name="ops_event_response_auto_event_response"></a>

 要想实现快速、一致和无错误的运营处理，自动响应事件是关键所在。创建简化的流程，使用多种工具来自动管理和响应事件，尽可能减少人工干预并提高运营效率。

 **期望结果：**
+  利用自动化功能，减少人为错误并缩短解决问题的用时。
+  一致且可靠的运营事件处理。
+  提高运营效率和系统可靠性。

 **常见反模式：**
+ 手动处理事件，容易导致延误和出错。
+ 忽视了自动化功能在重复性关键任务中的作用。
+  反复地手动执行任务，丧失了对警报的警惕性，导致遗漏关键问题。

 **建立此最佳实践的好处：**
+  加快事件响应速度，减少系统停机时间。
+  通过自动化和一致的事件处理，实现可靠的运营。

 **在未建立这种最佳实践的情况下暴露的风险等级：**中 

## 实施指导
<a name="implementation-guidance"></a>

 纳入自动化功能，创建高效的运营工作流程，并尽可能减少人工干预。

### 实施步骤
<a name="implementation-steps"></a>

1.  **发现自动化机会：**确定可以自动处理的重复性任务，例如问题修复、工单信息补充、容量管理、扩展、部署和测试。

1.  **发现自动化提示：**
   +  使用 [Amazon CloudWatch 警报操作](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-and-actions)评测并定义启动自动响应的特定条件或指标。
   +  使用 [Amazon EventBridge](https://aws.amazon.com/eventbridge/) 响应 AWS 服务、自定义工作负载和 SaaS 应用程序中的事件。
   +  考虑启动事件，例如[特定日志条目](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/MonitoringLogData.html)、[性能指标阈值](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html)或 AWS 资源中的[状态变更](https://docs.aws.amazon.com/config/latest/developerguide/remediation.html)。

1.  **实现事件驱动型自动化：**
   +  使用 AWS Systems Manager Automation 运行手册来简化维护、部署和修复任务。
   +  [在 Incident Manager 中创建意外事件](https://docs.aws.amazon.com/incident-manager/latest/userguide/incident-creation.html)，自动收集并添加与意外事件相关的 AWS 资源的详细信息。
   +  使用[适用于 AWS 的配额监控程序](https://aws.amazon.com/solutions/implementations/quota-monitor/)主动监控配额。
   +  使用 [AWS Auto Scaling](https://aws.amazon.com/autoscaling/) 自动调整容量，维持可用性和性能。
   +  使用 [Amazon CodeCatalyst](https://codecatalyst.aws/explore) 实现开发管道自动化。
   +  使用[综合监控](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries.html)进行烟雾测试或持续监控端点和 API。

1.  **通过自动化功能执行风险缓解：**
   +  实施[自动安全响应](https://aws.amazon.com/solutions/implementations/automated-security-response-on-aws/)，以便快速应对风险。
   +  使用 [AWS Systems Manager State Manager](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-state.html) 减少配置偏差。
   +  [使用 AWS Config 规则 修复不合规的资源](https://docs.aws.amazon.com/config/latest/developerguide/remediation.html)。

 **实施计划的工作量级别：**高 

## 资源
<a name="resources"></a>

 **相关最佳实践：**
+  [OPS08-BP04 创建可操作的警报](ops_workload_observability_create_alerts.md) 
+  [OPS10-BP02 针对每个警报设置一个流程](ops_event_response_process_per_alert.md) 

 **相关文档：**
+  [Using Systems Manager Automation runbooks with Incident Manager](https://docs.aws.amazon.com/incident-manager/latest/userguide/tutorials-runbooks.html) 
+  [Creating incidents in Incident Manager](https://docs.aws.amazon.com/incident-manager/latest/userguide/incident-creation.html) 
+  [AWS 服务限额](https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html) 
+  [Monitor resource usage and send notifications when approaching quotas](https://docs.aws.amazon.com/solutions/latest/quota-monitor-for-aws/solution-overview.html) 
+  [AWS Auto Scaling](https://aws.amazon.com/autoscaling/) 
+  [What is Amazon CodeCatalyst?](https://docs.aws.amazon.com/codecatalyst/latest/userguide/welcome.html)
+  [使用 Amazon CloudWatch 告警](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html) 
+  [使用 Amazon CloudWatch 警报操作](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-and-actions) 
+  [Remediating Noncompliant Resources with AWS Config 规则](https://docs.aws.amazon.com/config/latest/developerguide/remediation.html) 
+  [Creating metrics from log events using filters](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/MonitoringLogData.html) 
+  [AWS Systems Manager State Manager](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-state.html) 

 **相关视频：**
+ [Create Automation Runbooks with AWS Systems Manager](https://www.youtube.com/watch?v=fQ_KahCPBeU)
+ [How to automate IT Operations on AWS](https://www.youtube.com/watch?v=GuWj_mlyTug)
+ [AWS Security Hub CSPM automation rules](https://www.youtube.com/watch?v=XaMfO_MERH8)
+ [Start your software project fast with Amazon CodeCatalyst blueprints](https://www.youtube.com/watch?v=rp7roaoPzFE)

 **相关示例：**
+ [Amazon CodeCatalyst Tutorial: Creating a project with the Modern three-tier web application blueprint](https://docs.aws.amazon.com/codecatalyst/latest/userguide/getting-started-template-project.html)
+ [One Observability 讲习会](https://catalog.us-east-1.prod.workshops.aws/workshops/31676d37-bbe9-4992-9cd1-ceae13c5116c/en-US)
+ [Respond to incidents using Incident Manager](https://catalog.workshops.aws/getting-started-with-com/en-US/operations-management/incident-manager)