AWS CloudFormation
User Guide (API Version 2010-05-15)
AWS 服务或AWS文档中描述的功能,可能因地区/位置而异。请点击 Amazon AWS 入门,可查看中国地区的具体差异

AWS::GameLift::Build

AWS::GameLift::Build 资源可创建包含要在 Amazon GameLift (GameLift) 队列中运行游戏服务器所需的全部组件的生成包。

语法

要在 AWS CloudFormation 模板中声明此实体,请使用以下语法:

JSON

Copy
{ "Type" : "AWS::GameLift::Build", "Properties" : { "Name" : String, "StorageLocation" : StorageLocation, "Version" : String } }

YAML

Copy
Type: "AWS::GameLift::Build" Properties: Name: String StorageLocation: StorageLocation Version: String

属性

Name

与此生成包关联的标识符。生成包名称不必唯一。

Required: No

Type: String

更新要求无需中断

StorageLocation

存储生成包文件的 Amazon Simple Storage Service (Amazon S3) 位置。

Required: No,但建议您指定一个位置。如果不指定此属性,则必须手动将生成包文件上传到 GameLift。

Type: Amazon GameLift Build StorageLocation

更新要求替换

Version

与此生成包关联的版本。如果需要跟踪生成包文件的更新,版本很有用。版本不必唯一。

Required: No

Type: String

更新要求无需中断

返回值

Ref

如果向 Ref 内部函数提供此资源的逻辑 ID,Ref 将返回此生成包 ID,如 mybuild-a01234b56-7890-1de2-f345-g67h8i901j2k

有关使用 Ref 功能的更多信息,请参阅参考

示例

下面的示例创建一个名为 MyGameServerBuild 的 GameLift 生成包。此生成包位于通过 S3BucketS3Key 输入参数指定的 S3 存储桶中。此外,示例还创建 GameLift 担任的 AWS Identity and Access Management (IAM) 角色,以便它有权下载生成包文件。

JSON

Copy
"BuildResource": { "Type": "AWS::GameLift::Build", "Properties": { "Name": "MyGameServerBuild", "Version": "v15", "StorageLocation": { "Bucket": "mybucket", "Key": "buildpackagefiles/", "RoleArn": { "Fn::GetAtt": [ "IAMRole", "Arn" ] } } } }, "IAMRole": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "gamelift.amazonaws.com" ] }, "Action": [ "sts:AssumeRole" ] } ] }, "Path": "/", "Policies": [ { "PolicyName": "gamelift-s3-access-policy", "PolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": [ "arn:aws:s3:::mybucket/*" ] } ] } } ] } }

YAML

Copy
BuildResource: Type: "AWS::GameLift::Build" Properties: Name: "MyGameServerBuild" Version: "v15" StorageLocation: Bucket: "mybucket" Key: "buildpackagefiles/" RoleArn: Fn::GetAtt: - "IAMRole" - "Arn" IAMRole: Type: "AWS::IAM::Role" Properties: AssumeRolePolicyDocument: Version: "2012-10-17" Statement: - Effect: "Allow" Principal: Service: - "gamelift.amazonaws.com" Action: - "sts:AssumeRole" Path: "/" Policies: - PolicyName: "gamelift-s3-access-policy" PolicyDocument: Version: "2012-10-17" Statement: - Effect: "Allow" Action: - "s3:GetObject" Resource: - "arn:aws:s3:::mybucket/*"

本页内容: