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


Places a request for a new game session in a queue (see CreateGameSessionQueue). When processing a placement request, Amazon GameLift searches for available resources on the queue's destinations, scanning each until it finds resources or the placement request times out.

A game session placement request can also request player sessions. When a new game session is successfully created, Amazon GameLift creates a player session for each player included in the request.

When placing a game session, by default Amazon GameLift tries each fleet in the order they are listed in the queue configuration. Ideally, a queue's destinations are listed in preference order.

Alternatively, when requesting a game session with players, you can also provide latency data for each player in relevant regions. Latency data indicates the performance lag a player experiences when connected to a fleet in the region. Amazon GameLift uses latency data to reorder the list of destinations to place the game session in a region with minimal lag. If latency data is provided for multiple players, Amazon GameLift calculates each region's average lag for all players and reorders to get the best game play across all players.

To place a new game session request, specify the following:

  • The queue name and a set of game session properties and settings

  • A unique ID (such as a UUID) for the placement. You use this ID to track the status of the placement request

  • (Optional) A set of IDs and player data for each player you want to join to the new game session

  • Latency data for all players (if you want to optimize game play for the players)

If successful, a new game session placement is created.

To track the status of a placement request, call DescribeGameSessionPlacement and check the request's status. If the status is FULFILLED, a new game session has been created and a game session ARN and region are referenced. If the placement request times out, you can resubmit the request or retry it with a different queue.

Game-session-related operations include:

Request Syntax

{ "DesiredPlayerSessions": [ { "PlayerData": "string", "PlayerId": "string" } ], "GameProperties": [ { "Key": "string", "Value": "string" } ], "GameSessionData": "string", "GameSessionName": "string", "GameSessionQueueName": "string", "MaximumPlayerSessionCount": number, "PlacementId": "string", "PlayerLatencies": [ { "LatencyInMilliseconds": number, "PlayerId": "string", "RegionIdentifier": "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.


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


Name of the queue to use to place the new game session.

Type: String

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

Pattern: [a-zA-Z0-9-]+

Required: Yes


Maximum number of players that can be connected simultaneously to the game session.

Type: Integer

Valid Range: Minimum value of 0.

Required: Yes


Unique identifier to assign to the new game session placement. This value is developer-defined. The value must be unique across all regions and cannot be reused unless you are resubmitting a canceled or timed-out placement request.

Type: String

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

Pattern: [a-zA-Z0-9-]+

Required: Yes


Set of information on each player to create a player session for.

Type: Array of DesiredPlayerSession objects

Required: No


Set of developer-defined properties for a game session, formatted as a set of type:value pairs. These properties are included in the GameSession object, which is passed to the game server with a request to start a new game session (see Start a Game Session).

Type: Array of GameProperty objects

Array Members: Maximum number of 16 items.

Required: No


Set of developer-defined game session properties, formatted as a single string value. This data is included in the GameSession object, which is passed to the game server with a request to start a new game session (see Start a Game Session).

Type: String

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

Required: No


Descriptive label that is associated with a game session. Session names do not need to be unique.

Type: String

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

Required: No


Set of values, expressed in milliseconds, indicating the amount of latency that a player experiences when connected to AWS regions. This information is used to try to place the new game session where it can offer the best possible gameplay experience for the players.

Type: Array of PlayerLatency objects

Required: No

Response Syntax

{ "GameSessionPlacement": { "EndTime": number, "GameProperties": [ { "Key": "string", "Value": "string" } ], "GameSessionArn": "string", "GameSessionData": "string", "GameSessionId": "string", "GameSessionName": "string", "GameSessionQueueName": "string", "GameSessionRegion": "string", "IpAddress": "string", "MaximumPlayerSessionCount": number, "PlacedPlayerSessions": [ { "PlayerId": "string", "PlayerSessionId": "string" } ], "PlacementId": "string", "PlayerLatencies": [ { "LatencyInMilliseconds": number, "PlayerId": "string", "RegionIdentifier": "string" } ], "Port": number, "StartTime": number, "Status": "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.


Object that describes the newly created game session placement. This object includes all the information provided in the request, as well as start/end time stamps and placement status.

Type: GameSessionPlacement object


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


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


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

HTTP Status Code: 400


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

HTTP Status Code: 400


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

HTTP Status Code: 400


Request a new game session placement with player latency data

This example starts a new game session placement. The request calls for player sessions for two players, and provides each player's latency data for two regions.

Amazon GameLift uses the latency data provided to determine what order to use when looking for a fleet to host the new game session. It does this by calculating the average player latency for each region and ordering the queue's destinations starting with the lowest average latency. If the queue "matchmaker-queue" has a latency policy, however, things may change. For example, let's say matchmaker-queue has a policy that caps latency at 130 milliseconds for 60 seconds, followed by no cap. In this scenario, using the sample request below, the following sequence plays out:

  1. Amazon GameLift calculates average latency for each region: us-east-1 = 110 and us-west-2 = 100.

  2. Amazon GameLift reorders the queue's destinations based on lowest average latency, and prioritizes destinations in region us-west-2.

  3. The queue has a latency cap of 130 ms in force for the first 60 seconds of a placement. Amazon GameLift looks for any individual latency values that are greater than 130 ms. There is one: Player 2 reports a 150 ms latency when connected to region us-west-2. As a result, Amazon GameLift temporarily drops all us-west-2 fleets as valid destinations.

  4. Amazon GameLift tries to place the new game session on fleets in region us-east-1, followed by fleets in regions with no latency information (if any). If available resources are found, the game session is placed and the request fulfilled.

  5. If no available resources are found, Amazon GameLift starts a new round of placement attempts, restarting at step 3. If 60 seconds have passed and the latency policy is no longer in force, then fleets in region us-west-2 are once more valid destinations -- and are preferred based on their low average latency.

  6. Amazon GameLift continues to attempt to place the new game session until it is successful or until the queue's timeout limit is reached.

Sample Request

JSON syntax: { "DesiredPlayerSessions": [ { "PlayerData": "level:10", "PlayerId": "player1" }, { "PlayerData": "level:11", "PlayerId": "player2" }, ], "GameProperties": [ { "Key": "map", "Value": "winter" } ], "GameSessionName": "matchmaker-1234567890", "GameSessionQueueName": "matchmaker-queue", "MaximumPlayerSessionCount": 4, "PlacementId": "Place-12345", "PlayerLatencies": [ { "LatencyInMilliseconds": 100, "PlayerId": "player1", "RegionIdentifier": "us-east-1" }, { "LatencyInMilliseconds": 50, "PlayerId": "player1", "RegionIdentifier": "us-west-2" }, { "LatencyInMilliseconds": 120, "PlayerId": "player2", "RegionIdentifier": "us-east-1" }, { "LatencyInMilliseconds": 150, "PlayerId": "player2", "RegionIdentifier": "us-west-2" }, ] }

See Also

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