本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
(選用) 設定 Amazon SNS 以接收有關 OpsItems 的通知
您可以設定 OpsCenter,以在系統建立 OpsItem 或更新現有 OpsItem 時,將通知傳送至 Amazon Simple Notification Service (Amazon SNS) 主題。
完成下列步驟以接收 OpsItems 的通知。
-
注意
如果在步驟 2 開啟了 AWS Key Management Service (AWS KMS) 伺服器端加密,則必須完成步驟 3。否則,可以略過步驟 3。
步驟 1:建立並訂閱 Amazon SNS 主題
若要接收通知,您必須建立並訂閱 Amazon SNS 主題。如需詳細資訊,請參閱《Amazon Simple Notification Service 開發人員指南》中的建立 Amazon SNS 主題和訂閱 Amazon SNS 主題。
注意
如果要在多個 AWS 區域 或帳戶中使用 OpsCenter,則必須在要接收 OpsItem 通知的每個區域或帳戶中,建立並訂閱 Amazon SNS 主題。
步驟 2:更新 Amazon SNS 存取政策
您必須將 Amazon SNS 主題與 OpsItems 相關聯。使用以下程序設定 Amazon SNS 存取政策,讓 Systems Manager 可以將 OpsItems 通知發佈至您在步驟 1 中建立的 Amazon SNS 主題。
登入 AWS Management Console,並在 https://console.aws.amazon.com/sns/v3/home
開啟 Amazon SNS 主控台。 -
在導覽窗格中,選擇主題。
-
選擇在步驟 1 中建立的主題,然後選擇編輯。
-
展開 Access policy (存取政策)。
-
將以下
Sid
區塊新增至現有的政策。將每個範例資源預留位置
取代為您自己的資訊。{ "Sid": "Allow OpsCenter to publish to this topic", "Effect": "Allow", "Principal": { "Service": "ssm.amazonaws.com" }, "Action": "SNS:Publish", "Resource": "arn:aws:sns:
region
:account ID
:topic name
", // Account ID of the SNS topic owner "Condition": { "StringEquals": { "AWS:SourceAccount": "account ID
" // Account ID of the OpsItem owner } } }注意
aws:SourceAccount
全域條件金鑰可防止混淆代理人情境。若要使用此條件金鑰,請將值設定為相應 OpsItem 擁有者的帳戶 ID。如需詳細資訊,請參閱《IAM 使用者指南》中的混淆代理一節。 -
選擇儲存變更。
現在,建立或更新 OpsItems 時,系統會傳送通知給 Amazon SNS 主題。
重要
如果您在步驟 2 中使用 AWS Key Management Service (AWS KMS) 伺服器端加密金鑰設定 Amazon SNS 主題,則請完成步驟 3。否則,可以略過步驟 3。
步驟 3:更新 AWS KMS 存取政策
如果啟用了 Amazon SNS 主題的 AWS KMS 伺服器端加密,則必須更新在設定主題時所選 AWS KMS key 的存取政策。使用下列程序更新存取政策,讓 Systems Manager 可以將 OpsItem 通知發佈至您在步驟 1 中建立的 Amazon SNS 主題。
注意
OpsCenter 不支援將 OpsItems 發佈至以 AWS 受管金鑰 設定的 Amazon SNS 主題。
-
開啟位於 https://console.aws.amazon.com/kms
的 AWS KMS 主控台。 -
若要變更 AWS 區域,請使用頁面右上角的區域選取器。
-
在導覽窗格中,選擇 Customer managed keys (客戶受管金鑰)。
-
選擇您在建立主題時所選擇 KMS 金鑰的 ID。
-
在 Key policy (金鑰政策) 區段中,選擇 Switch to policy view (切換至政策檢視)。
-
選擇編輯。
-
將以下
Sid
區塊新增至現有的政策。將每個範例資源預留位置
取代為您自己的資訊。{ "Sid": "Allow OpsItems to decrypt the key", "Effect": "Allow", "Principal": { "Service": "ssm.amazonaws.com" }, "Action": ["kms:Decrypt", "kms:GenerateDataKey*"], "Resource": "arn:aws:kms:
region
:account ID
:key/key ID
" }在以下範例中,第 14 行輸入新區塊。
-
選擇儲存變更。
步驟 4:開啟預設 OpsItems 規則以傳送有關新 OpsItems 的通知
Amazon EventBridge 中的預設 OpsItems 規則未設定 Amazon Resource Name (ARN) 來傳送 Amazon SNS 通知。使用下列程序在 EventBridge 中編輯規則並輸入 notifications
區塊。
將通知區塊新增至預設 OpsItem 規則
開啟位於 https://console.aws.amazon.com/systems-manager/
的 AWS Systems Manager 主控台。 -
在導覽窗格中,選擇 OpsCenter。
-
選擇 OpsItems 索引標籤,然後選擇 Configure sources (設定來源)。
-
選擇您要以
notifications
區塊設定的來源規則名稱,如下列範例所示。規則在 Amazon EventBridge 中開啟。
-
在規則詳細資訊頁面的 Targets (目標) 索引標籤上,選擇 Edit (編輯)。
-
在 Additional settings (其他設定) 區段中,選擇 Configure input transformer (設定輸入轉換器)。
-
在範本方塊中,以下列格式新增
notifications
區塊。"notifications":[{"arn":"arn:aws:sns:
region
:account ID
:topic name
"}],範例如下。
"notifications":[{"arn":"arn:aws:sns:us-west-2:1234567890:MySNSTopic"}],
輸入
resources
區塊前的通知區塊,如下列美國西部 (奧勒岡) (us-west-2) 區域範例所示。{ "title": "EBS snapshot copy failed", "description": "CloudWatch Event Rule SSMOpsItems-EBS-snapshot-copy-failed was triggered. Your EBS snapshot copy has failed. See below for more details.", "category": "Availability", "severity": "2", "source": "EC2", "notifications": [{ "arn": "arn:aws:sns:us-west-2:1234567890:MySNSTopic" }], "resources": <resources>, "operationalData": { "/aws/dedup": { "type": "SearchableString", "value": "{\"dedupString\":\"SSMOpsItems-EBS-snapshot-copy-failed\"}" }, "/aws/automations": { "value": "[ { \"automationType\": \"AWS:SSM:Automation\", \"automationId\": \"AWS-CopySnapshot\" } ]" }, "failure-cause": { "value": <failure - cause> }, "source": { "value": <source> }, "start-time": { "value": <start - time> }, "end-time": { "value": <end - time> } } }
-
選擇確認。
-
選擇下一步。
-
選擇下一步。
-
選擇更新規則。
系統下次為預設規則建立 OpsItem 時,就會將通知發佈至 Amazon SNS 主題。