AWS::GameLift::Build - AWS CloudFormation

AWS::GameLift::Build

The AWS::GameLift::Build resource creates a game server build that is installed and run on instances in an Amazon GameLift fleet. This resource points to an Amazon S3 location that contains a zip file with all of the components of the game server build.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

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

YAML

Type: AWS::GameLift::Build Properties: Name: String OperatingSystem: String ServerSdkVersion: String StorageLocation: StorageLocation Version: String

Properties

Name

A descriptive label that is associated with a build. Build names do not need to be unique.

Required: No

Type: String

Minimum: 1

Maximum: 1024

Update requires: No interruption

OperatingSystem

The operating system that your game server binaries run on. This value determines the type of fleet resources that you use for this build. If your game build contains multiple executables, they all must run on the same operating system. You must specify a valid operating system in this request. There is no default value. You can't change a build's operating system later.

Note

Amazon Linux 2 (AL2) will reach end of support on 6/30/2025. See more details in the Amazon Linux 2 FAQs. For game servers that are hosted on AL2 and use Amazon GameLift server SDK 4.x., first update the game server build to server SDK 5.x, and then deploy to AL2023 instances. See Migrate to Amazon GameLift server SDK version 5.

Required: No

Type: String

Allowed values: AMAZON_LINUX | AMAZON_LINUX_2 | AMAZON_LINUX_2023 | WINDOWS_2012 | WINDOWS_2016

Update requires: Replacement

ServerSdkVersion

A server SDK version you used when integrating your game server build with Amazon GameLift. For more information see Integrate games with custom game servers. By default Amazon GameLift sets this value to 4.0.2.

Required: No

Type: String

Pattern: ^\d+\.\d+\.\d+$

Maximum: 128

Update requires: Replacement

StorageLocation

Information indicating where your game build files are stored. Use this parameter only when creating a build with files stored in an Amazon S3 bucket that you own. The storage location must specify an Amazon S3 bucket name and key. The location must also specify a role ARN that you set up to allow Amazon GameLift to access your Amazon S3 bucket. The S3 bucket and your new build must be in the same Region.

If a StorageLocation is specified, the size of your file can be found in your Amazon S3 bucket. Amazon GameLift will report a SizeOnDisk of 0.

Required: No

Type: StorageLocation

Update requires: Replacement

Version

Version information that is associated with this build. Version strings do not need to be unique.

Required: No

Type: String

Minimum: 1

Maximum: 1024

Update requires: No interruption

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the build ID, such as build-1111aaaa-22bb-33cc-44dd-5555eeee66ff.

For more information about using the Ref function, see Ref.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

BuildId

A unique identifier for the build.

Examples

Create a Custom Game Server Build

The following example creates a GameLift build named MyGameServerBuild. The build package is located in an S3 bucket, specified by the S3Bucket and S3Key input parameters. The example also creates the AWS Identity and Access Management role that GameLift assumes so that it has permissions to download the build package files.

JSON

{ "Resources": { "IAMRole": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "cloudformation.amazonaws.com", "gamelift.amazonaws.com" ] }, "Action": "sts:AssumeRole" } ] }, "RoleName": "BuildIAMRole", "Policies": [ { "PolicyName": "gamelift-s3-access-policy", "PolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetObject", "s3:GetObjectVersion", "s3:GetObjectMetadata", "s3:*Object*" ], "Resource": [ "arn:aws:s3:::MyBucketName/*" ] } ] } } ] } }, "BuildResource": { "Type": "AWS::GameLift::Build", "Properties": { "Name": "MyGameServerBuild", "Version": "v1.0", "OperatingSystem": "WINDOWS_2012", "ServerSdkVersion: "5.0.0", "StorageLocation": { "Bucket": "MyBucketName", "Key": "MyGameBuildFiles.zip", "RoleArn": { "Fn::GetAtt": [ "IAMRole", "Arn" ] } } } } } }

YAML

Resources: IAMRole: Type: "AWS::IAM::Role" Properties: AssumeRolePolicyDocument: Version: "2012-10-17" Statement: - Effect: "Allow" Principal: Service: ["cloudformation.amazonaws.com", "gamelift.amazonaws.com"] Action: "sts:AssumeRole" RoleName: "BuildIAMRole" Policies: - PolicyName: gamelift-s3-access-policy PolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Action: - "s3:GetObject" - "s3:GetObjectVersion" - "s3:GetObjectMetadata" - "s3:*Object*" Resource: - "arn:aws:s3:::MyBucketName/*" BuildResource: Type: AWS::GameLift::Build Properties: Name: MyGameServerBuild Version: v1.0 OperatingSystem: WINDOWS_2012 ServerSdkVersion: 5.0.0 StorageLocation: Bucket: "MyBucketName" Key: "MyGameBuildFiles.zip" RoleArn: !GetAtt IAMRole.Arn

See also