@aws-cdk_aws-gamelift-alpha.GameServerGroup

class GameServerGroup (construct) ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.GameLift.Alpha.GameServerGroup
Gogithub.com/aws/aws-cdk-go/awscdkgameliftalpha/v2#GameServerGroup
Javasoftware.amazon.awscdk.services.gamelift.alpha.GameServerGroup
Pythonaws_cdk.aws_gamelift_alpha.GameServerGroup
TypeScript (source)@aws-cdk/aws-gamelift-alpha ยป GameServerGroup

Implements IConstruct, IDependable, IResource, IGameServerGroup, IGrantable

Creates a GameLift FleetIQ game server group for managing game hosting on a collection of Amazon EC2 instances for game hosting.

This operation creates the game server group, creates an Auto Scaling group in your AWS account, and establishes a link between the two groups. 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. Before creating a new game server group, you must have the following:

  • An Amazon EC2 launch template that specifies how to launch Amazon EC2 instances with your game server build.
  • An IAM role that extends limited access to your AWS account to allow GameLift FleetIQ to create and interact with the Auto Scaling group.

To create a new game server group, specify a unique group name, IAM role and Amazon EC2 launch template, and provide a list of instance types that can be used in the group. You must also set initial maximum and minimum limits on the group's instance count. You can optionally set an Auto Scaling policy with target tracking based on a GameLift FleetIQ metric.

Once the game server group and corresponding Auto Scaling group are created, you have full access to change the Auto Scaling group's configuration as needed. Several properties that are set when creating a game server group, including maximum/minimum size and auto-scaling policy settings, must be updated directly in the Auto Scaling group. Keep in mind that some Auto Scaling group properties are periodically updated by GameLift FleetIQ as part of its balancing activities to optimize for availability and cost.

See also: https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/gsg-intro.html

Example

declare const launchTemplate: ec2.ILaunchTemplate;
declare const vpc: ec2.IVpc;

new gamelift.GameServerGroup(this, 'GameServerGroup', {
  gameServerGroupName: 'sample-gameservergroup-name',
  instanceDefinitions: [{
    instanceType: ec2.InstanceType.of(ec2.InstanceClass.C5, ec2.InstanceSize.LARGE),
  },
  {
    instanceType: ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
  }],
  launchTemplate: launchTemplate,
  vpc: vpc,
  vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }
});

Initializer

new GameServerGroup(scope: Construct, id: string, props: GameServerGroupProps)

Parameters

  • scope Construct
  • id string
  • props GameServerGroupProps

Construct Props

NameTypeDescription
gameServerGroupName๐Ÿ”นstringA developer-defined identifier for the game server group.
instanceDefinitions๐Ÿ”นInstanceDefinition[]The set of Amazon EC2 instance types that GameLift FleetIQ can use when balancing and automatically scaling instances in the corresponding Auto Scaling group.
launchTemplate๐Ÿ”นILaunchTemplateThe Amazon EC2 launch template that contains configuration settings and game server code to be deployed to all instances in the game server group.
vpc๐Ÿ”นIVpcThe VPC network to place the game server group in.
autoScalingPolicy?๐Ÿ”นAutoScalingPolicyConfiguration settings to define a scaling policy for the Auto Scaling group that is optimized for game hosting.
balancingStrategy?๐Ÿ”นBalancingStrategyIndicates how GameLift FleetIQ balances the use of Spot Instances and On-Demand Instances in the game server group.
deleteOption?๐Ÿ”นDeleteOptionThe type of delete to perform.
maxSize?๐Ÿ”นnumberThe maximum number of instances allowed in the Amazon EC2 Auto Scaling group.
minSize?๐Ÿ”นnumberThe minimum number of instances allowed in the Amazon EC2 Auto Scaling group.
protectGameServer?๐Ÿ”นbooleanA flag that indicates whether instances in the game server group are protected from early termination.
role?๐Ÿ”นIRoleThe IAM role that allows Amazon GameLift to access your Amazon EC2 Auto Scaling groups.
vpcSubnets?๐Ÿ”นSubnetSelectionGame server group subnet selection.

gameServerGroupName๐Ÿ”น

Type: string

A developer-defined identifier for the game server group.

The name is unique for each Region in each AWS account.


instanceDefinitions๐Ÿ”น

Type: InstanceDefinition[]

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


launchTemplate๐Ÿ”น

Type: ILaunchTemplate

The Amazon EC2 launch template that contains configuration settings and game server code to be deployed to all instances in the game server group.

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.

See also: https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-template.html


vpc๐Ÿ”น

Type: IVpc

The VPC network to place the game server group in.

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.


autoScalingPolicy?๐Ÿ”น

Type: AutoScalingPolicy (optional, default: no autoscaling policy settled)

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.


balancingStrategy?๐Ÿ”น

Type: BalancingStrategy (optional, default: SPOT_PREFERRED)

Indicates how GameLift FleetIQ balances the use of Spot Instances and On-Demand Instances in the game server group.


deleteOption?๐Ÿ”น

Type: DeleteOption (optional, default: SAFE_DELETE)

The type of delete to perform.

To delete a game server group, specify the DeleteOption


maxSize?๐Ÿ”น

Type: number (optional, default: the default is 1)

The maximum number of instances allowed in the Amazon 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.


minSize?๐Ÿ”น

Type: number (optional, default: the default is 0)

The minimum number of instances allowed in the Amazon EC2 Auto Scaling group.

During automatic scaling events, GameLift FleetIQ and Amazon 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.


protectGameServer?๐Ÿ”น

Type: boolean (optional, default: game servers running might be terminated during a scale-down event)

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.

An exception to this is with Spot Instances, which can be terminated by AWS regardless of protection status.


role?๐Ÿ”น

Type: IRole (optional, default: a role will be created with default trust to Gamelift and Autoscaling service principal with a default policy GameLiftGameServerGroupPolicy attached.)

The IAM role that allows Amazon GameLift to access your Amazon EC2 Auto Scaling groups.

See also: https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/gsg-iam-permissions-roles.html


vpcSubnets?๐Ÿ”น

Type: SubnetSelection (optional, default: all GameLift FleetIQ-supported Availability Zones are used.)

Game server group subnet selection.

Properties

NameTypeDescription
autoScalingGroupArn๐Ÿ”นstringThe ARN of the generated AutoScaling group.
env๐Ÿ”นResourceEnvironmentThe environment this resource belongs to.
gameServerGroupArn๐Ÿ”นstringThe ARN of the game server group.
gameServerGroupName๐Ÿ”นstringThe name of the game server group.
grantPrincipal๐Ÿ”นIPrincipalThe principal this GameLift game server group is using.
node๐Ÿ”นNodeThe tree node.
role๐Ÿ”นIRoleThe IAM role that allows Amazon GameLift to access your Amazon EC2 Auto Scaling groups.
stack๐Ÿ”นStackThe stack in which this resource is defined.
vpc๐Ÿ”นIVpcThe VPC network to place the game server group in.
vpcSubnets?๐Ÿ”นSubnetSelectionThe game server group's subnets.

autoScalingGroupArn๐Ÿ”น

Type: string

The ARN of the generated AutoScaling group.


env๐Ÿ”น

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


gameServerGroupArn๐Ÿ”น

Type: string

The ARN of the game server group.


gameServerGroupName๐Ÿ”น

Type: string

The name of the game server group.


grantPrincipal๐Ÿ”น

Type: IPrincipal

The principal this GameLift game server group is using.


node๐Ÿ”น

Type: Node

The tree node.


role๐Ÿ”น

Type: IRole

The IAM role that allows Amazon GameLift to access your Amazon EC2 Auto Scaling groups.


stack๐Ÿ”น

Type: Stack

The stack in which this resource is defined.


vpc๐Ÿ”น

Type: IVpc

The VPC network to place the game server group in.


vpcSubnets?๐Ÿ”น

Type: SubnetSelection (optional)

The game server group's subnets.

Methods

NameDescription
applyRemovalPolicy(policy)๐Ÿ”นApply the given removal policy to this resource.
grant(grantee, ...actions)๐Ÿ”นGrant the grantee identity permissions to perform actions.
metric(metricName, props?)๐Ÿ”นReturn the given named metric for this fleet.
toString()๐Ÿ”นReturns a string representation of this construct.
protected parseAutoScalingPolicy(props)๐Ÿ”น
protected parseInstanceDefinitions(props)๐Ÿ”น
protected parseLaunchTemplate(props)๐Ÿ”น
static fromGameServerGroupAttributes(scope, id, attrs)๐Ÿ”นImport an existing game server group from its attributes.

applyRemovalPolicy(policy)๐Ÿ”น

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).


grant(grantee, ...actions)๐Ÿ”น

public grant(grantee: IGrantable, ...actions: string[]): Grant

Parameters

  • grantee IGrantable
  • actions string

Returns

  • Grant

Grant the grantee identity permissions to perform actions.


metric(metricName, props?)๐Ÿ”น

public metric(metricName: string, props?: MetricOptions): Metric

Parameters

  • metricName string
  • props MetricOptions

Returns

  • Metric

Return the given named metric for this fleet.


toString()๐Ÿ”น

public toString(): string

Returns

  • string

Returns a string representation of this construct.


protected parseAutoScalingPolicy(props)๐Ÿ”น

protected parseAutoScalingPolicy(props: GameServerGroupProps): AutoScalingPolicyProperty

Parameters

  • props GameServerGroupProps

Returns

  • AutoScalingPolicyProperty

protected parseInstanceDefinitions(props)๐Ÿ”น

protected parseInstanceDefinitions(props: GameServerGroupProps): InstanceDefinitionProperty[]

Parameters

  • props GameServerGroupProps

Returns

  • InstanceDefinitionProperty[]

protected parseLaunchTemplate(props)๐Ÿ”น

protected parseLaunchTemplate(props: GameServerGroupProps): LaunchTemplateProperty

Parameters

  • props GameServerGroupProps

Returns

  • LaunchTemplateProperty

static fromGameServerGroupAttributes(scope, id, attrs)๐Ÿ”น

public static fromGameServerGroupAttributes(scope: Construct, id: string, attrs: GameServerGroupAttributes): IGameServerGroup

Parameters

  • scope Construct
  • id string
  • attrs GameServerGroupAttributes

Returns

  • IGameServerGroup

Import an existing game server group from its attributes.