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

RequestUploadCredentials

Retrieves a fresh set of credentials for use when uploading a new set of game build files to Amazon GameLift's Amazon S3. This is done as part of the build creation process; see CreateBuild.

To request new credentials, specify the build ID as returned with an initial CreateBuild request. If successful, a new set of credentials are returned, along with the S3 storaage location associated with the build ID.

Request Syntax

{
   "BuildId": "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.

BuildId

Unique identifier for a build to get credentials for.

Type: String

Pattern: ^build-\S+

Required: Yes

Response Syntax

{
   "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.

StorageLocation

Amazon S3 path and key, identifying where the game build files are stored.

Type: S3Location object

UploadCredentials

AWS credentials required when uploading a game build to the storage location. These credentials have a limited lifespan and are valid only for the build they were issued for.

Type: AwsCredentials object

Errors

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

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

NotFoundException

A service resource associated with the request could not be found. Clients should not retry such requests.

HTTP Status Code: 400

UnauthorizedException

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

HTTP Status Code: 400

Example

Refresh access credentials for uploading a build

This example obtains new, valid access credentials for uploading a build file to Amazon GameLift's S3 account. Credentials, which are provided when you create a build record using CreateBuild, have a limited lift span. The build ID required for this operation is returned in response to the original CreateBuild request.

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: 63
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.RequestUploadCredentials 

{
    "BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff"
}

Sample Response

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

{
    "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: