

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 教程：设置 Amazon SNS 主题
<a name="match-notification-sns"></a>

您可以让 Amazon GameLift Servers 将 FlexMatch 对战构建器生成的所有事件发布到 Amazon SNS 主题中。

**为 Amazon GameLift Servers 事件通知创建 SNS 主题**

1. 打开 [Amazon SNS 控制台](https://console.amazonaws.cn/sns)。

1. 在导航窗格中，选择**主题**。

1. 在 **Topics**（主页）页面上，选择 **Create topic**（创建主题）。

1. 在 控制台中，创建一个主题。有关更多信息，请参阅《Amazon Simple Notification Service 开发人员指南》**中的[创建主题 Amazon Web Services 管理控制台](https://docs.amazonaws.cn/sns/latest/dg/sns-create-topic.html#create-topic-aws-console)。

1. 在主题的**详细信息**页面上，选择**编辑**。

1. （可选）在主题的**编辑**页面上，展开**访问策略**，然后将以下 Amazon Identity and Access Management (IAM) 策略声明中的粗体语法添加到现有策略的末尾。(为清晰起见显示了整个策略。) 请务必将 Amazon 资源名称（ARN）详细信息用于您自己的 SNS 主题和 Amazon GameLift Servers 对战配置。

------
#### [ JSON ]

****  

   ```
   {
     "Version":"2012-10-17",		 	 	 
     "Id": "__default_policy_ID",
     "Statement": [
       {
         "Sid": "__default_statement_ID",
         "Effect": "Allow",
         "Principal": {
           "AWS": "*"
         },
         "Action": [
           "SNS:GetTopicAttributes",
           "SNS:SetTopicAttributes",
           "SNS:AddPermission",
           "SNS:RemovePermission",
           "SNS:DeleteTopic",
           "SNS:Subscribe",
           "SNS:ListSubscriptionsByTopic",
           "SNS:Publish"
         ],
         "Resource": "arn:aws:sns:us-east-1:111122223333:your_topic_name",
         "Condition": {
           "StringEquals": {
           "AWS:SourceAccount": "111122223333"
           }
         }
       },
       {
         "Sid": "__console_pub_0",
         "Effect": "Allow",
         "Principal": {
           "Service": "gamelift.amazonaws.com"
         },
         "Action": "SNS:Publish",
         "Resource": "arn:aws:sns:us-east-1:111122223333:your_topic_name",
         "Condition": {
           "ArnLike": {
           "aws:SourceArn": "arn:aws:gamelift:us-east-1:111122223333:matchmakingconfiguration/your_configuration_name"
           }
         }
       }
     ]
   }
   ```

------

1. 选择**保存更改**。