亚马逊 IAM 权限示例 GameLift - 亚马逊 GameLift
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

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

亚马逊 IAM 权限示例 GameLift

使用这些示例中的语法为需要访问亚马逊GameLift资源的用户设置 Amazon Identity and Access Management (IAM) 权限。有关管理用户权限的更多信息,请参阅管理亚马逊的用户权限 GameLift。在管理 IAM Identity Center 之外的用户的权限时,最佳做法是始终向 IAM 角色或用户组授予权限,而不是向个人用户授予权限。

如果您使用亚马逊 GameLift FleetIQ 作为独立解决方案,请参阅Amazon Web Services 账户为亚马逊 GameLift FleetiQ 设置您的解决方案。

管理员权限示例

这些示例为用户提供了管理亚马逊GameLift游戏托管资源的完全访问权限。

例 亚马逊GameLift资源权限的语法

以下示例扩展了对所有 Amazon GameLift 资源的访问权限。

{ "Version": "2012-10-17", "Statement": { "Effect": "Allow", "Action": "gamelift:*", "Resource": "*" } }
例 支持默认未启用的区域的 Amazon GameLift 资源权限语法

以下示例将访问权限扩展到默认情况下未启用的所有 Amazon GameLift 资源和Amazon区域。有关默认情况下未启用的区域以及如何启用它们的更多信息,请参阅Amazon Web Services 区域中的管理Amazon Web Services 一般参考

{ "Version": "2012-10-17", "Statement": { "Effect": "Allow", "Action": [ "ec2:DescribeRegions", "gamelift:*" ], "Resource": "*" } }
例 亚马逊GameLift资源和PassRole权限的语法

以下示例扩展了对所有 Amazon GameLift 资源的访问权限,并允许用户将 IAM 服务角色传递给 Amazon GameLift。服务角色使亚马逊能够GameLift有限地代表您访问其他资源和服务,如中所述为亚马逊设置 IAM 服务角色GameLift。例如,在响应CreateBuild请求时,亚马逊GameLift需要访问您在 Amazon S3 存储桶中的构建文件。有关该PassRole操作的更多信息,请参阅 IAM 用户指南中的 IAM:将 IAM 角色传递给特定Amazon服务

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "gamelift:*", "Resource": "*" }, { "Effect": "Allow", "Action": "iam:PassRole", "Resource": "*", "Condition": { "StringEquals": { "iam:PassedToService": "gamelift.amazonaws.com" } } } ] }

玩家用户权限示例

这些示例允许后端服务或其他实体对亚马逊 API 进行 AP GameLift I 调用。它们涵盖了管理游戏会话、玩家会话和配对的常见场景。有关更多信息,请参阅 为您的游戏设置编程访问权限

例 游戏会话放置权限的语法

以下示例扩展了对使用游戏会话放置队列来创建游戏会话和管理玩家会话GameLift的 Amazon API 的访问权限。

{ "Version": "2012-10-17", "Statement": { "Sid": "PlayerPermissionsForGameSessionPlacements", "Effect": "Allow", "Action": [ "gamelift:StartGameSessionPlacement", "gamelift:DescribeGameSessionPlacement", "gamelift:StopGameSessionPlacement", "gamelift:CreatePlayerSession", "gamelift:CreatePlayerSessions", "gamelift:DescribeGameSessions" ], "Resource": "*" } }
例 配对权限的语法

以下示例扩展了对管理FlexMatch配对活动的亚马逊 GameLift API 的访问权限。FlexMatch为新的或现有的游戏会话匹配玩家,并为在亚马逊GameLift上托管的游戏启动游戏会话放置。有关的更多信息FlexMatch,请参阅什么是亚马逊 GameLiftFlexMatch?

{ "Version": "2012-10-17", "Statement": { "Sid": "PlayerPermissionsForGameSessionMatchmaking", "Effect": "Allow", "Action": [ "gamelift:StartMatchmaking", "gamelift:DescribeMatchmaking", "gamelift:StopMatchmaking", "gamelift:AcceptMatch", "gamelift:StartMatchBackfill", "gamelift:DescribeGameSessions" ], "Resource": "*" } }
例 手动游戏会话放置权限的语法

以下示例扩展了对在指定队列上手动创建游戏会话和玩家会话GameLift的 Amazon API 的访问权限。此场景支持不使用放置队列的游戏,例如允许玩家从可用游戏会话列表中进行选择加入的游戏(“list-and-pick” 方法)。

{ "Version": "2012-10-17", "Statement": { "Sid": "PlayerPermissionsForManualGameSessions", "Effect": "Allow", "Action": [ "gamelift:CreateGameSession", "gamelift:DescribeGameSessions", "gamelift:SearchGameSessions", "gamelift:CreatePlayerSession", "gamelift:CreatePlayerSessions", "gamelift:DescribePlayerSessions" ], "Resource": "*" } }