Amazon GameLift 的 IAM 权限示例 - Amazon GameLift

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

Amazon GameLift 的 IAM 权限示例

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

如果使用 Amazon GameLift FleetIQ 作为独立解决方案,请参阅为 Amazon GameLift FleetIQ 进行 AWS 账户设置

管理员权限示例

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

例 Amazon GameLift 资源权限语法

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

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

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

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

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

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

玩家用户权限示例

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

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

以下示例扩展了对 Amazon GameLift API 的访问权限,这些 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 对战活动的 Amazon GameLift API 的访问权限。FlexMatch 为玩家匹配新游戏或现有游戏会话,并启动 Amazon GameLift 上托管的游戏的游戏会话放置。有关 FlexMatch 的更多信息,请参阅什么是 Amazon GameLift FlexMatch?

{ "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 API 的访问权限,这些 API 可以在指定实例集上手动创建游戏会话和玩家会话。此场景支持不使用放置队列的游戏,例如允许玩家通过从可用游戏会话列表中进行选择来加入的游戏(“列表和选择”方法)。

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