RegisterGameServer - Amazon GameLift Service

RegisterGameServer

This operation is part of Amazon GameLift FleetIQ with game server groups, which is in preview release and is subject to change.

Creates a new game server resource and notifies GameLift FleetIQ that the game server is ready to host gameplay and players. This operation is called by a game server process that is running on an instance in a game server group. Registering game servers enables GameLift FleetIQ to track available game servers and enables game clients and services to claim a game server for a new game session.

To register a game server, identify the game server group and instance where the game server is running, and provide a unique identifier for the game server. You can also include connection and game server data. When a game client or service requests a game server by calling ClaimGameServer, this information is returned in the response.

Once a game server is successfully registered, it is put in status AVAILABLE. A request to register a game server may fail if the instance it is in the process of shutting down as part of instance rebalancing or scale-down activity.

Learn more

GameLift FleetIQ Guide

Related operations

Request Syntax

{ "ConnectionInfo": "string", "CustomSortKey": "string", "GameServerData": "string", "GameServerGroupName": "string", "GameServerId": "string", "InstanceId": "string", "Tags": [ { "Key": "string", "Value": "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

An identifier for the game server group where the game server is running. You can 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 new game server. Game server IDs are developer-defined and must be unique across all game server groups in your AWS account.

Type: String

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

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

Required: Yes

InstanceId

The unique identifier for the instance where the game server is running. This ID is available in the instance metadata.

Type: String

Length Constraints: Fixed length of 19.

Pattern: ^i-[0-9a-zA-Z]{17}$

Required: Yes

ConnectionInfo

Information that is needed to make inbound client connections to the game server. This might include the IP address and port, DNS name, and other information.

Type: String

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

Pattern: .*\S.*

Required: No

CustomSortKey

A game server tag that can be used to request sorted lists of game servers using ListGameServers. Custom sort keys are developer-defined based on how you want to organize the retrieved game server information.

Type: String

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

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

Required: No

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

Tags

A list of labels to assign to the new game server resource. Tags are developer-defined key-value pairs. Tagging AWS resources is useful for resource management, access management, and cost allocation. For more information, see Tagging AWS Resources in the AWS General Reference. After the resource is created, you can use TagResource, UntagResource, and ListTagsForResource to add, remove, and view tags. The maximum tag limit may be lower than stated. See the AWS General Reference for actual tagging limits.

Type: Array of Tag objects

Array Members: Minimum number of 0 items. Maximum number of 200 items.

Required: No

Response Syntax

{ "GameServer": { "ClaimStatus": "string", "ConnectionInfo": "string", "CustomSortKey": "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 created game server resource.

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

LimitExceededException

The requested operation would cause the resource to exceed the allowed service limit. Resolve the issue before retrying.

HTTP Status Code: 400

UnauthorizedException

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

HTTP Status Code: 400

Example

Register a game server

This example illustrates how an instance of a game server build notifies GameLift that it is ready to host a game.

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

Sample Request

{ "GameServerGroupName": "MegaFrogServers_NA", "ConnectionInfo": "192.0.2.0.80", "GameServerId": "mega-frog-game-12345678", "InstanceId": "i-1234567890abcdef0" } CLI command: aws gamelift register-game-server \ --game-server-group-name MegaFrogServers_NA \ --connection-info "192.0.2.0.80" \ --game-server-id mega-frog-game-12345678 \ --instance-id i-1234567890abcdef0

Sample Response

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

See Also

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