UpdateGameServerGroup - Amazon GameLift Service

UpdateGameServerGroup

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

Updates GameLift FleetIQ-specific properties for a game server group. Many Auto Scaling group properties are updated on the Auto Scaling group directly, including the launch template, Auto Scaling policies, and maximum/minimum/desired instance counts.

To update the game server group, specify the game server group ID and provide the updated values. Before applying the updates, the new values are validated to ensure that GameLift FleetIQ can continue to perform instance balancing activity. If successful, a GameServerGroup object is returned.

Learn more

GameLift FleetIQ Guide

Related operations

Request Syntax

{ "BalancingStrategy": "string", "GameServerGroupName": "string", "GameServerProtectionPolicy": "string", "InstanceDefinitions": [ { "InstanceType": "string", "WeightedCapacity": "string" } ], "RoleArn": "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. 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

BalancingStrategy

Indicates how GameLift FleetIQ balances the use of Spot Instances and On-Demand Instances in the game server group. Method options include the following:

  • SPOT_ONLY - Only Spot Instances are used in the game server group. If Spot Instances are unavailable or not viable for game hosting, the game server group provides no hosting capacity until Spot Instances can again be used. Until then, no new instances are started, and the existing nonviable Spot Instances are terminated (after current gameplay ends) and are not replaced.

  • SPOT_PREFERRED - (default value) Spot Instances are used whenever available in the game server group. If Spot Instances are unavailable, the game server group continues to provide hosting capacity by falling back to On-Demand Instances. Existing nonviable Spot Instances are terminated (after current gameplay ends) and are replaced with new On-Demand Instances.

  • ON_DEMAND_ONLY - Only On-Demand Instances are used in the game server group. No Spot Instances are used, even when available, while this balancing strategy is in force.

Type: String

Valid Values: SPOT_ONLY | SPOT_PREFERRED | ON_DEMAND_ONLY

Required: No

GameServerProtectionPolicy

A flag that indicates whether instances in the game server group are protected from early termination. Unprotected instances that have active game servers running might be terminated during a scale-down event, causing players to be dropped from the game. Protected instances cannot be terminated while there are active game servers running except in the event of a forced game server group deletion (see ). An exception to this is with Spot Instances, which can be terminated by AWS regardless of protection status. This property is set to NO_PROTECTION by default.

Type: String

Valid Values: NO_PROTECTION | FULL_PROTECTION

Required: No

InstanceDefinitions

An updated list of EC2 instance types to use in the Auto Scaling group. The instance definitions must specify at least two different instance types that are supported by GameLift FleetIQ. This updated list replaces the entire current list of instance definitions for the game server group. For more information on instance types, see EC2 Instance Types in the Amazon EC2 User Guide. You can optionally specify capacity weighting for each instance type. If no weight value is specified for an instance type, it is set to the default value "1". For more information about capacity weighting, see Instance Weighting for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.

Type: Array of InstanceDefinition objects

Array Members: Minimum number of 2 items. Maximum number of 20 items.

Required: No

RoleArn

The Amazon Resource Name (ARN) for an IAM role that allows Amazon GameLift to access your EC2 Auto Scaling groups.

Type: String

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

Pattern: ^arn:.*:role\/[\w+=,.@-]+

Required: No

Response Syntax

{ "GameServerGroup": { "AutoScalingGroupArn": "string", "BalancingStrategy": "string", "CreationTime": number, "GameServerGroupArn": "string", "GameServerGroupName": "string", "GameServerProtectionPolicy": "string", "InstanceDefinitions": [ { "InstanceType": "string", "WeightedCapacity": "string" } ], "LastUpdatedTime": number, "RoleArn": "string", "Status": "string", "StatusReason": "string", "SuspendedActions": [ "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.

GameServerGroup

An object that describes the game server group resource with updated properties.

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

Examples

Update instance definitions for the game server group

This example specifies a new set of instance definitions for the game server group. Previously, the game server group used a Spot-only balancing strategy with c3.xlarge and c4.xlarge instance types. This request removes the old instance definitions and replaces them. As shown in the response, because the new definitions do not specify WeightedCapacity, these are set to the default value of 1.

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

Sample Request

{ "GameServerGroupName": "MegaFrogServers_NA", "InstanceDefinitions": [ {"InstanceType": "c4.xlarge"}, {"InstanceType": "c5.xlarge"} ] } CLI command: aws gamelift update-game-server-group \ --game-server-group MegaFrogServers_NA \ --instance-definitions '[{"InstanceType": "c4.xlarge"}, {"InstanceType": "c5.xlarge"}]'

Sample Response

{ "GameServerGroup": { "AutoScalingGroupArn": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:1111aaaa-22bb-33cc-44dd-5555eeee66ff:autoScalingGroupName/MegaFrogServers_NA", "BalancingStrategy": "SPOT_ONLY", "CreationTime": 1496365885.44, "GameServerGroupArn": "arn:aws:gamelift:us-west-2::GameServerGroup/MegaFrogServers_NA", "GameServerGroupName": " MegaFrogServers_NA", "GameServerProtectionPolicy": "NO_PROTECTION", "InstanceDefinitions": [ { "InstanceType": "c4.xlarge", "WeightedCapacity": "1" }, { "InstanceType": "c5.xlarge", "WeightedCapacity": "1" } ], "LastUpdatedTime": 1496365885.44, "RoleArn": "arn:aws:iam:123456789012::role/GameLiftGsgRole", "Status": "ACTIVE", "StatusReason": "", "SuspendedActions": [] }

Change the balancing strategy for a game server group

This example changes the game server group's balancing strategy from preferring Spot instances to using On-Demand instances only. In this example scenario, the game developer wants to eliminate the possibility of game session interruptions during an upcoming highly-anticipated content launch. Later, once player demand settles, the balancing strategy can be updated again to use Spot instances for cost savings.

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

Sample Request

{ "GameServerGroupName": "MegaFrogServers_NA", "BalancingStrategy": "ON_DEMAND_ONLY" } CLI command: aws gamelift update-game-server-group \ --game-server-group MegaFrogServers_NA \ --balancing-strategy ON_DEMAND_ONLY

Sample Response

{ "GameServerGroup": { "AutoScalingGroupArn": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:1111aaaa-22bb-33cc-44dd-5555eeee66ff:autoScalingGroupName/MegaFrogServers_NA", "BalancingStrategy": "ON_DEMAND_ONLY", "CreationTime": 1496365885.44, "GameServerGroupArn": "arn:aws:gamelift:us-west-2::GameServerGroup/MegaFrogServers_NA", "GameServerGroupName": " MegaFrogServers_NA", "GameServerProtectionPolicy": "FULL_PROTECTION", "InstanceDefinitions": [ { "InstanceType": "c4.xlarge", "WeightedCapacity": "1" }, { "InstanceType": "c5.xlarge", "WeightedCapacity": "1" } ], "LastUpdatedTime": 1496365885.44, "RoleArn": "arn:aws:iam:123456789012::role/GameLiftGsgRole", "Status": "ACTIVE", "StatusReason": "", "SuspendedActions": [] }

See Also

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