

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# `AWS-EnableCWAlarm`
<a name="enable-cw-alarm"></a>

**Description**

`AWS-EnableCWAlarm` Runbook 會為 中尚無 AWS 資源 AWS 帳戶 的資源建立 Amazon CloudWatch (CloudWatch) 警示。系統會為下列 AWS 資源建立 CloudWatch 警示：
+ Amazon Elastic Compute Cloud (Amazon EC2) 執行個體
+ Amazon Elastic Block Store (Amazon EBS) 磁碟區
+ Amazon Simple Storage Service (Amazon S3) 儲存貯體
+ Amazon Relational Database Service (Amazon RDS) 叢集

[執行此自動化 （主控台）](https://console.aws.amazon.com/systems-manager/automation/execute/AWS-EnableCWAlarm)

**文件類型**

 自動化

**擁有者**

Amazon

**平台**

Linux、macOS、 Windows

**參數**
+ AutomationAssumeRole

  類型：字串

  描述：（選用） 允許 Systems Manager Automation 代表您執行動作的 (IAM) 角色的 AWS Identity and Access Management Amazon Resource Name (ARN)。如果未指定角色，Systems Manager Automation 會使用啟動此 Runbook 的使用者許可。
+ ComparisonOperator

  類型：字串

  有效值：GreaterThanOrEqualToThreshold \$1 GreaterThanThreshold \$1 GreaterThanUpperThreshold \$1 LessThanLowerOrGreaterThanUpperThreshol \$1 LessThanLowerThreshold \$1 LessThanOrEqualToThreshold \$1 LessThanThreshold

  描述：（必要） 比較指定的統計資料和閾值時要使用的算術操作。
+ MetricName

  類型：字串

  描述：（必要） 與警示相關聯的指標名稱。
+ 期間

  類型：整數

  有效值：10 \$1 30 \$1 60 \$1 60 的倍數

  描述：（必要） 套用統計資料的期間，以秒為單位。
+ ResourceARNs

  類型：StringList

  描述：（必要） 以逗號分隔的資源 ARNs 清單，以建立 的 CloudWatch 警示
+ 統計數字

  類型：字串

  有效值：平均值 \$1 最大值 \$1 最小值 \$1 SampleCount \$1 總和

  描述：（必要） 與警示相關聯的指標統計資料。
+ Threshold

  類型：整數

  描述：（必要） 要與指定統計資料比較的值。

**必要的 IAM 許可**

`AutomationAssumeRole` 參數需要下列動作才能成功使用 Runbook。
+ `cloudwatch:PutMetricAlarm`

**文件步驟**
+ `aws:executeScript` - 根據您在參數 中指定之資源的 Runbook `ResourceARNs` 參數中指定的值，建立 CloudWatch 警示。

**輸出**

EnableCWAlarm.FailedResources:未建立 CloudWatch 警示的資源 ARNs 映射清單，以及失敗的原因。

EnableCWAlarm.SuccessfulResources:已成功建立 CloudWatch 警示的資源 ARNs 清單。