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 Amazon 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:StringOperatingSystem:StringServerSdkVersion:StringStorageLocation:StorageLocationVersion: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:
1Maximum:
1024Update 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
If you have active fleets using the Windows Server 2012 operating system, you can continue to create new builds using this OS until October 10, 2023, when Microsoft ends its support. All others must use Windows Server 2016 when creating new Windows-based builds.
Required: No
Type: String
Allowed values:
AMAZON_LINUX | AMAZON_LINUX_2 | WINDOWS_2012 | WINDOWS_2016Update requires: Replacement
ServerSdkVersion-
The Amazon GameLift Server SDK version used to develop your game server.
Required: No
Type: String
Maximum:
128Pattern:
^\d+\.\d+\.\d+$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
StorageLocationis specified, the size of your file can be found in your Amazon S3 bucket. Amazon GameLift will report aSizeOnDiskof 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:
1Maximum:
1024Update requires: No interruption
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Reffunction, Refreturns the build ID, such as
build-1111aaaa-22bb-33cc-44dd-5555eeee66ff.
For more information about using the Reffunction, see Ref.
Fn::GetAtt
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 Amazon 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: "4.0.2", "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: 4.0.2, StorageLocation: Bucket: "MyBucketName" Key: "MyGameBuildFiles.zip" RoleArn: !GetAtt IAMRole.Arn
See also
Create GameLift resources using Amazon CloudFront in the Amazon GameLift Developer Guide
-
Create a build with files in Amazon S3 in the Amazon GameLift Developer Guide
-
Upload script files in Amazon S3 in the Amazon GameLift Developer Guide
CreateBuild in the Amazon GameLift API Reference