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

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

的 IAM 权限示例 Amazon GameLift Servers

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

如果您要Amazon GameLift ServersFleetIQ用作独立解决方案,请参阅设置您 Amazon Web Services 账户 的Amazon GameLift ServersFleetIQ

管理权限示例

这些示例为托管管理员或开发者提供了管理Amazon GameLift Servers游戏托管资源的定向访问权限。

例 Amazon GameLift Servers完全访问资源权限的语法

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

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

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

{ "Version": "2012-10-17", "Statement": { "Effect": "Allow", "Action": [ "ec2:DescribeRegions", "gamelift:*" ], "Resource": "*" } }
例 访问 Amazon ECR 中容器镜像的Amazon GameLift Servers资源语法

以下示例扩展了用户在使用托管容器队列时所需的亚马逊弹性容器注册表 (Amazon ECR) 操作Amazon GameLift Servers的访问权限。

{ "Version": "2012-10-17", "Statement": { "Effect": "Allow", "Action": [ "ecr:DescribeImages", "ecr:BatchGetImage", "ecr:GetDownloadUrlForLayer" ], "Resource": "*" } }
例 Amazon GameLift Servers资源和PassRole权限的语法

以下示例扩展了对所有Amazon GameLift Servers资源的访问权限,并允许用户将 IAM 服务角色传递给Amazon GameLift Servers。服务角色Amazon GameLift Servers限制了代表您访问其他资源和服务的能力,如中所述为设置 IAM 服务角色 Amazon GameLift Servers。例如,在响应CreateBuild请求时,Amazon GameLift Servers需要访问您在 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 进行 API 调用。Amazon GameLift Servers它们涵盖了管理游戏会话、玩家会话和对战的常见场景。有关更多信息,请参阅为游戏设置编程式访问权限

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

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

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

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

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

以下示例扩展了对在Amazon GameLift Servers APIs 指定队列上手动创建游戏会话和玩家会话的访问权限。此场景支持不使用放置队列的游戏,例如允许玩家通过从可用游戏会话列表中进行选择来加入的游戏(“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": "*" } }