AWS::GameLift::GameServerGroup - AWS CloudFormation

AWS::GameLift::GameServerGroup

This operation is used with the Amazon GameLift FleetIQ solution.

The AWS::GameLift::GameServerGroup resource creates a GameLift FleetIQ game server group and EC2 Auto Scaling group to manage game hosting on a collection of Amazon EC2 instances in your AWS account. You can view the status of your game server groups in the GameLift console. Game server group metrics and events are emitted to Amazon CloudWatch.

To establish this resource, you must have:

  • An Amazon EC2 launch template that specifies how to launch Amazon EC2 instances with your game server build. For more information, see Launching an Instance from a Launch Template in the Amazon EC2 User Guide.

  • An IAM role with limited access to your AWS account that allows GameLift FleetIQ to create and interact with the Auto Scaling group. For more information, see Create IAM roles for cross-service interaction in the GameLift FleetIQ Developer Guide.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::GameLift::GameServerGroup", "Properties" : { "AutoScalingPolicy" : AutoScalingPolicy, "BalancingStrategy" : String, "DeleteOption" : String, "GameServerGroupName" : String, "GameServerProtectionPolicy" : String, "InstanceDefinitions" : [ InstanceDefinition, ... ], "LaunchTemplate" : LaunchTemplate, "MaxSize" : Double, "MinSize" : Double, "RoleArn" : String, "Tags" : [ Tag, ... ], "VpcSubnets" : [ String, ... ] } }

YAML

Type: AWS::GameLift::GameServerGroup Properties: AutoScalingPolicy: AutoScalingPolicy BalancingStrategy: String DeleteOption: String GameServerGroupName: String GameServerProtectionPolicy: String InstanceDefinitions: - InstanceDefinition LaunchTemplate: LaunchTemplate MaxSize: Double MinSize: Double RoleArn: String Tags: - Tag VpcSubnets: - String

Properties

AutoScalingPolicy

Configuration settings to define a scaling policy for the Auto Scaling group that is optimized for game hosting. The scaling policy uses the metric "PercentUtilizedGameServers" to maintain a buffer of idle game servers that can immediately accommodate new games and players. After the Auto Scaling group is created, update this value directly in the Auto Scaling group using the AWS console or APIs.

Required: No

Type: AutoScalingPolicy

Update requires: No interruption

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.

Required: No

Type: String

Allowed values: ON_DEMAND_ONLY | SPOT_ONLY | SPOT_PREFERRED

Update requires: No interruption

DeleteOption

The type of delete to perform. Options include the following:

  • SAFE_DELETE – (default) Terminates the game server group and EC2 Auto Scaling group only when it has no game servers that are in UTILIZED status.

  • FORCE_DELETE – Terminates the game server group, including all active game servers regardless of their utilization status, and the EC2 Auto Scaling group.

  • RETAIN – Does a safe delete of the game server group but retains the EC2 Auto Scaling group as is.

Required: No

Type: String

Allowed values: FORCE_DELETE | RETAIN | SAFE_DELETE

Update requires: No interruption

GameServerGroupName

A developer-defined identifier for the game server group. The name is unique for each Region in each AWS account.

Required: Yes

Type: String

Minimum: 1

Maximum: 128

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

Update requires: No interruption

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.

Required: No

Type: String

Allowed values: FULL_PROTECTION | NO_PROTECTION

Update requires: No interruption

InstanceDefinitions

The set of EC2 instance types that GameLift FleetIQ can use when balancing and automatically scaling instances in the corresponding Auto Scaling group.

Required: Yes

Type: List of InstanceDefinition

Maximum: 20

Update requires: No interruption

LaunchTemplate

The EC2 launch template that contains configuration settings and game server code to be deployed to all instances in the game server group. You can specify the template using either the template name or ID. For help with creating a launch template, see Creating a Launch Template for an Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide. After the Auto Scaling group is created, update this value directly in the Auto Scaling group using the AWS console or APIs.

Note

If you specify network interfaces in your launch template, you must explicitly set the property AssociatePublicIpAddress to "true". If no network interface is specified in the launch template, GameLift FleetIQ uses your account's default VPC.

Required: Yes

Type: LaunchTemplate

Update requires: No interruption

MaxSize

The maximum number of instances allowed in the EC2 Auto Scaling group. During automatic scaling events, GameLift FleetIQ and EC2 do not scale up the group above this maximum. After the Auto Scaling group is created, update this value directly in the Auto Scaling group using the AWS console or APIs.

Required: No

Type: Double

Minimum: 1

Update requires: No interruption

MinSize

The minimum number of instances allowed in the EC2 Auto Scaling group. During automatic scaling events, GameLift FleetIQ and EC2 do not scale down the group below this minimum. In production, this value should be set to at least 1. After the Auto Scaling group is created, update this value directly in the Auto Scaling group using the AWS console or APIs.

Required: No

Type: Double

Minimum: 0

Update requires: No interruption

RoleArn

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

Required: Yes

Type: String

Minimum: 1

Maximum: 256

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

Update requires: No interruption

Tags

An array of key-value pairs to apply to this resource.

For more information, see Tag.

Required: No

Type: List of Tag

Update requires: No interruption

VpcSubnets

A list of virtual private cloud (VPC) subnets to use with instances in the game server group. By default, all GameLift FleetIQ-supported Availability Zones are used. You can use this parameter to specify VPCs that you've set up. This property cannot be updated after the game server group is created, and the corresponding Auto Scaling group will always use the property value that is set with this request, even if the Auto Scaling group is updated directly.

Required: No

Type: List of String

Maximum: 20

Update requires: No interruption

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the game server group Amazon Resource Name (ARN) . For example: arn:aws:gamelift:us-west-2::GameServerGroup/my-gsg.

For more information about using the Ref function, see Ref.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

AutoScalingGroupArn

The Amazon Resource Name (ARN) for the Auto Scaling Group. For example: arn:aws:autoscaling:us-west-2::autoScalingGroup:1111aaaa-22bb-33cc-44dd-5555eeee66ff:autoScalingGroupName/my-asg.

GameServerGroupArn

The ARN for the game server group. For example: arn:aws:gamelift:us-west-2::GameServerGroup/my-gsg.

See also