UpdateGameServer - Amazon GameLift Service

UpdateGameServer

This operation is used with the Amazon GameLift FleetIQ solution and game server groups.

Updates information about a registered game server to help GameLift FleetIQ to track game server availability. This operation is called by a game server process that is running on an instance in a game server group.

Use this operation to update the following types of game server information. You can make all three types of updates in the same request:

  • To update the game server's utilization status, identify the game server and game server group and specify the current utilization status. Use this status to identify when game servers are currently hosting games and when they are available to be claimed.

  • To report health status, identify the game server and game server group and set health check to HEALTHY. If a game server does not report health status for a certain length of time, the game server is no longer considered healthy. As a result, it will be eventually deregistered from the game server group to avoid affecting utilization metrics. The best practice is to report health every 60 seconds.

  • To change game server metadata, provide updated game server data.

Once a game server is successfully updated, the relevant statuses and timestamps are updated.

Learn more

GameLift FleetIQ Guide

Related operations

Request Syntax

{ "GameServerData": "string", "GameServerGroupName": "string", "GameServerId": "string", "HealthCheck": "string", "UtilizationStatus": "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.

GameServerGroupName

A unique identifier for the game server group where the game server is running. Use either the GameServerGroup name or ARN value.

Type: String

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

Pattern: [a-zA-Z0-9-\.]+|^arn:.*:gameservergroup\/[a-zA-Z0-9-\.]+

Required: Yes

GameServerId

A custom string that uniquely identifies the game server to update.

Type: String

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

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

Required: Yes

GameServerData

A set of custom game server properties, formatted as a single string value. This data is passed to a game client or service when it requests information on game servers using ListGameServers or ClaimGameServer.

Type: String

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

Pattern: .*\S.*

Required: No

HealthCheck

Indicates health status of the game server. A request that includes this parameter updates the game server's LastHealthCheckTime timestamp.

Type: String

Valid Values: HEALTHY

Required: No

UtilizationStatus

Indicates whether the game server is available or is currently hosting gameplay.

Type: String

Valid Values: AVAILABLE | UTILIZED

Required: No

Response Syntax

{ "GameServer": { "ClaimStatus": "string", "ConnectionInfo": "string", "GameServerData": "string", "GameServerGroupArn": "string", "GameServerGroupName": "string", "GameServerId": "string", "InstanceId": "string", "LastClaimTime": number, "LastHealthCheckTime": number, "RegistrationTime": number, "UtilizationStatus": "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.

GameServer

Object that describes the newly updated game server.

Type: GameServer 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

Report that a game server is now hosting gameplay

This example changes the utilization status of a game server and reports the results of a health check. Prior to this call, the game server's utilization status is AVAILABLE and the claim status is CLAIMED.

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

Sample Request

{ "GameServerGroupName": "MegaFrogServers_NA", "HealthCheck": "HEALTHY"}, "UtilizationStatus": "UTILIZED" } CLI command: aws gamelift update-game-server \ --game-server-group-name MegaFrogServers_NA \ --health-check HEALTHY \ --utilization-status UTILIZED

Sample Response

{ "GameServer": { "ClaimStatus": "", "ConnectionInfo": "192.0.2.0.80", "GameServerData": "", "GameServerGroupArn": "arn:aws:gamelift:us-west-2::GameServerGroup/MegaFrogServers_NA", "GameServerGroupName": "MegaFrogServers_NA", "GameServerId": "mega-frog-game-12345678", "InstanceId": "i-1234567890abcdef0", "LastClaimTime": 1580218290.293, "LastHealthCheckTime": 1580218294.293, "RegistrationTime": 1580218197.293, "UtilizationStatus": "UTILIZED" } }

See Also

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