

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

# 建立 Amazon SNS 主題
<a name="sms-workforce-management-private-sns"></a>

為工作團隊通知建立 Amazon SNS 主題的步驟與 *Amazon SNS X開發人員指南*中[入門](https://docs.aws.amazon.com/sns/latest/dg/sns-getting-started.html)的步驟類似，但有一項重要新增項目：您必須新增存取政策，以便 Amazon SageMaker AI 可以代表您將訊息發佈到主題。

如果您使用主控台建立工作團隊，主控台會提選項來為團隊建立新主題，讓您不必執行這些步驟。

**重要**  
Amazon A2I 不支援 Amazon SNS 功能。如果您為工作團隊訂閱 Amazon SNS 主題，工作者將只會收到 Ground Truth 標籤工作的相關通知。工作者不會收到新 Amazon A2I 人工審核任務的相關通知。

**建立主題時新增政策**

1. 在 [https://console.aws.amazon.com/sns/v3/home](https://console.aws.amazon.com/sns/v3/home) 開啟 Amazon SNS 主控台。

1. 在**建立主題**中，輸入主題的名稱，然後選擇**後續步驟**。

1. 在**存取政策**中，選擇**進階**。

1. 在 **JSON 編輯器**中，尋找 `Resource` 屬性，該屬性顯示主題的 ARN。

1. 複製 `Resource` ARN 值。

1. 在最後右大括號 (`]`) 之前，新增下列政策。

   ```
       , {
           "Sid": "AwsSagemaker_SnsAccessPolicy",
           "Effect": "Allow",
           "Principal": {
               "Service": "sagemaker.amazonaws.com"
           },
           "Action": "sns:Publish",
           "Resource": "arn:partition:sns:region:111122223333:MyTopic", # ARN of the topic you copied in the previous step
           "Condition": {
               "ArnLike": {
                   "aws:SourceArn": "arn:partition:sagemaker:region:111122223333:workteam/*" # Workteam ARN
               },
               "StringEquals": {
                   "aws:SourceAccount": "111122223333" # SNS topic account
               }
           }
       }
   ```

1. 建立主題。

建立主題後，該主題會出現在**主題**摘要畫面中。如需建立主題的更多相關資訊，請參閱 *Amazon SNS 開發人員指南*中的[建立主題主題](https://docs.aws.amazon.com/sns/latest/dg/sns-tutorial-create-topic.html)。