Menu
Amazon GameLift Service
API Reference (API Version 2015-10-01)

CreateBuild

Creates a new Amazon GameLift build record for your game server binary files and points to the location of your game server build files in an Amazon Simple Storage Service (Amazon S3) location.

Game server binaries must be combined into a .zip file for use with Amazon GameLift. See Uploading Your Game for more information.

Important

To create new builds quickly and easily, use the AWS CLI command upload-build . This helper command uploads your build and creates a new build record in one step, and automatically handles the necessary permissions. See Upload Build Files to Amazon GameLift for more help.

The CreateBuild operation should be used only when you need to manually upload your build files, as in the following scenarios:

  • Store a build file in an Amazon S3 bucket under your own AWS account. To use this option, you must first give Amazon GameLift access to that Amazon S3 bucket. See Create a Build with Files in Amazon S3 for detailed help. To create a new build record using files in your Amazon S3 bucket, call CreateBuild and specify a build name, operating system, and the storage location of your game build.

  • Upload a build file directly to Amazon GameLift's Amazon S3 account. To use this option, you first call CreateBuild with a build name and operating system. This action creates a new build record and returns an Amazon S3 storage location (bucket and key only) and temporary access credentials. Use the credentials to manually upload your build file to the storage location (see the Amazon S3 topic Uploading Objects). You can upload files to a location only once.

If successful, this operation creates a new build record with a unique build ID and places it in INITIALIZED status. You can use DescribeBuild to check the status of your build. A build must be in READY status before it can be used to create fleets.

Build-related operations include:

Request Syntax

{
   "Name": "string",
   "OperatingSystem": "string",
   "StorageLocation": { 
      "Bucket": "string",
      "Key": "string",
      "RoleArn": "string"
   },
   "Version": "string"
}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

Note

In the following list, the required parameters are described first.

Name

Descriptive label that is associated with a build. Build names do not need to be unique. You can use UpdateBuild to change this value later.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No

OperatingSystem

Operating system that the game server binaries are built to run on. This value determines the type of fleet resources that you can use for this build. If your game build contains multiple executables, they all must run on the same operating system. If an operating system is not specified when creating a build, Amazon GameLift uses the default value (WINDOWS_2012). This value cannot be changed later.

Type: String

Valid Values: WINDOWS_2012 | AMAZON_LINUX

Required: No

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, as well as a role ARN that you set up to allow Amazon GameLift to access your Amazon S3 bucket. The S3 bucket must be in the same region that you want to create a new build in.

Type: S3Location object

Required: No

Version

Version that is associated with this build. Version strings do not need to be unique. You can use UpdateBuild to change this value later.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No

Response Syntax

{
   "Build": { 
      "BuildId": "string",
      "CreationTime": number,
      "Name": "string",
      "OperatingSystem": "string",
      "SizeOnDisk": number,
      "Status": "string",
      "Version": "string"
   },
   "StorageLocation": { 
      "Bucket": "string",
      "Key": "string",
      "RoleArn": "string"
   },
   "UploadCredentials": { 
      "AccessKeyId": "string",
      "SecretAccessKey": "string",
      "SessionToken": "string"
   }
}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

Build

The newly created build record, including a unique build ID and status.

Type: Build object

StorageLocation

Amazon S3 location for your game build file, including bucket name and key.

Type: S3Location object

UploadCredentials

This element is returned only when the operation is called without a storage location. It contains credentials to use when you are uploading a build file to an Amazon S3 bucket that is owned by Amazon GameLift. Credentials have a limited life span. To refresh these credentials, call RequestUploadCredentials.

Type: AwsCredentials object

Errors

For information about the errors that are common to all actions, see Common Errors.

ConflictException

The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request.

HTTP Status Code: 400

InternalServiceException

The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.

HTTP Status Code: 500

InvalidRequestException

One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.

HTTP Status Code: 400

UnauthorizedException

The client failed authentication. Clients should not retry such requests.

HTTP Status Code: 400

Examples

Create a build with files in your own S3 bucket

This example creates a new build record using a build file that is stored in your own Amazon S3 bucket. The example assumes that you've already created a role that gives Amazon GameLift permission to access your bucket. Once the build file is successfully validated, the new build's status changes to READY. Notice that the example request does not specify an operating system; in this scenario, the new build defaults to WINDOWS_2012.

HTTP requests are authenticated using an AWS Signature Version 4 signature in the Authorization header field.

Sample Request

POST / HTTP/1.1
Host: gamelift.us-west-2.amazonaws.com;
Accept-Encoding: identity
Content-Length: 259
User-Agent: aws-cli/1.11.36 Python/2.7.9 Windows/7 botocore/1.4.93
Content-Type: application/x-amz-json-1.0
Authorization: AWS4-HMAC-SHA256  Credential=AKIAIOSFODNN7EXAMPLE/20170406/us-west-2/gamelift/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
X-Amz-Date: 20170406T004805Z
X-Amz-Target: GameLift.CreateBuild 

{
    "Name": "My_Game_Server_Build_One",
    "Version": "12345.678",
    "StorageLocation": {
        "Bucket": "my_game_build_files",
        "Key": "mygame_build_7.0.1, 7.0.2",
        "RoleArn": "arn:aws:iam::111122223333:role/GameLiftAccess"
    } 
}

Sample Response

HTTP/1.1 200 OK
x-amzn-RequestId: b34f8665-EXAMPLE
Content-Type: application/x-amz-json-1.1
Content-Length: 427
Date: Thu, 06 Apr 2017 00:48:07 GMT

{
    "Build": {
        "BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", 
        "CreationTime": 1496708916.18, 
        "Name": "My_Game_Server_Build_One", 
        "OperatingSystem": "WINDOWS_2012", 
        "SizeOnDisk": 0, 
        "Status": "INITIALIZED", 
        "Version": "12345.678"
    }, 
    "StorageLocation": {
        "Bucket": "my_game_build_files", 
        "Key": "mygame_build_7.0.1, 7.0.2"
    } 
}

Create a build and upload your game server files to Amazon GameLift's S3 bucket

This example creates a new build record AND gets a storage location and temporary credentials that allow you to manually upload a game build to Amazon GameLift's Amazon S3 account. Once you've successfully uploaded your build, the Amazon GameLift service is notified and the new build's status changes to READY.

HTTP requests are authenticated using an AWS Signature Version 4 signature in the Authorization header field.

Sample Request

POST / HTTP/1.1
Host: gamelift.us-west-2.amazonaws.com;
Accept-Encoding: identity
Content-Length: 109
User-Agent: aws-cli/1.11.36 Python/2.7.9 Windows/7 botocore/1.4.93
Content-Type: application/x-amz-json-1.0
Authorization: AWS4-HMAC-SHA256  Credential=AKIAIOSFODNN7EXAMPLE/20170406/us-west-2/gamelift/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
X-Amz-Date: 20170406T004805Z
X-Amz-Target: GameLift.CreateBuild 

{
    "Name": "My_Game_Server_Build_One",
    "Version": "12345.678",
    "OperatingSystem": "AMAZON_LINUX"
}

Sample Response

HTTP/1.1 200 OK
x-amzn-RequestId: b34f8665-EXAMPLE
Content-Type: application/x-amz-json-1.1
Content-Length: 677
Date: Thu, 06 Apr 2017 00:48:07 GMT

{
    "Build": {
       "BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", 
        "CreationTime": 1496708916.18, 
        "Name": "My_Game_Server_Build_One", 
        "OperatingSystem": "AMAZON_LINUX", 
        "SizeOnDisk": 0, 
        "Status": "INITIALIZED", 
        "Version": "12345.678"
    }, 
    "StorageLocation": {
        "Bucket": "gamelift-builds-us-west-2", 
        "Key": "123456789012/build-1111aaaa-22bb-33cc-44dd-5555eeee66ff"
    }, 
    "UploadCredentials": {
        "AccessKeyId": "AKIAIOSFODNN7EXAMPLE", 
        "SecretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", 
        "SessionToken": "AgoGb3JpZ2luENz...EXAMPLETOKEN=="
    }
}

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: