Class CfnGameServerGroup
- All Implemented Interfaces:
IConstruct
,IDependable
,IInspectable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
AWS::GameLift::GameServerGroup
.
This operation is used with the Amazon GameLift FleetIQ solution and game server groups.
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. For more information, see Launching an Instance from a Launch Template in the Amazon EC2 User Guide .
- An IAM role that extends limited access to your AWS account to allow 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 .
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.
Learn more
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.services.gamelift.*; CfnGameServerGroup cfnGameServerGroup = CfnGameServerGroup.Builder.create(this, "MyCfnGameServerGroup") .gameServerGroupName("gameServerGroupName") .instanceDefinitions(List.of(InstanceDefinitionProperty.builder() .instanceType("instanceType") // the properties below are optional .weightedCapacity("weightedCapacity") .build())) .roleArn("roleArn") // the properties below are optional .autoScalingPolicy(AutoScalingPolicyProperty.builder() .targetTrackingConfiguration(TargetTrackingConfigurationProperty.builder() .targetValue(123) .build()) // the properties below are optional .estimatedInstanceWarmup(123) .build()) .balancingStrategy("balancingStrategy") .deleteOption("deleteOption") .gameServerProtectionPolicy("gameServerProtectionPolicy") .launchTemplate(LaunchTemplateProperty.builder() .launchTemplateId("launchTemplateId") .launchTemplateName("launchTemplateName") .version("version") .build()) .maxSize(123) .minSize(123) .tags(List.of(CfnTag.builder() .key("key") .value("value") .build())) .vpcSubnets(List.of("vpcSubnets")) .build();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
This data type is used with the GameLift FleetIQ and game server groups..static final class
A fluent builder forCfnGameServerGroup
.static interface
This data type is used with the Amazon GameLift FleetIQ and game server groups..static interface
This data type is used with the GameLift FleetIQ and game server groups..static interface
This data type is used with the Amazon GameLift FleetIQ and game server groups..Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionCfnGameServerGroup
(Construct scope, String id, CfnGameServerGroupProps props) Create a newAWS::GameLift::GameServerGroup
.protected
CfnGameServerGroup
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnGameServerGroup
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionA unique identifier for the auto scaling group.A unique identifier for the game server group.Configuration settings to define a scaling policy for the Auto Scaling group that is optimized for game hosting.Indicates how Amazon GameLift FleetIQ balances the use of Spot Instances and On-Demand Instances in the game server group.The type of delete to perform.A developer-defined identifier for the game server group.A flag that indicates whether instances in the game server group are protected from early termination.The set of Amazon EC2 instance types that Amazon GameLift FleetIQ can use when balancing and automatically scaling instances in the corresponding Auto Scaling group.The Amazon EC2 launch template that contains configuration settings and game server code to be deployed to all instances in the game server group.The maximum number of instances allowed in the Amazon EC2 Auto Scaling group.The minimum number of instances allowed in the Amazon EC2 Auto Scaling group.The Amazon Resource Name ( ARN ) for an IAM role that allows Amazon GameLift to access your Amazon EC2 Auto Scaling groups.getTags()
A list of labels to assign to the new game server group resource.A list of virtual private cloud (VPC) subnets to use with instances in the game server group.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
setAutoScalingPolicy
(IResolvable value) Configuration settings to define a scaling policy for the Auto Scaling group that is optimized for game hosting.void
Configuration settings to define a scaling policy for the Auto Scaling group that is optimized for game hosting.void
setBalancingStrategy
(String value) Indicates how Amazon GameLift FleetIQ balances the use of Spot Instances and On-Demand Instances in the game server group.void
setDeleteOption
(String value) The type of delete to perform.void
setGameServerGroupName
(String value) A developer-defined identifier for the game server group.void
A flag that indicates whether instances in the game server group are protected from early termination.void
setInstanceDefinitions
(List<Object> value) The set of Amazon EC2 instance types that Amazon GameLift FleetIQ can use when balancing and automatically scaling instances in the corresponding Auto Scaling group.void
The set of Amazon EC2 instance types that Amazon GameLift FleetIQ can use when balancing and automatically scaling instances in the corresponding Auto Scaling group.void
setLaunchTemplate
(IResolvable value) The Amazon EC2 launch template that contains configuration settings and game server code to be deployed to all instances in the game server group.void
The Amazon EC2 launch template that contains configuration settings and game server code to be deployed to all instances in the game server group.void
setMaxSize
(Number value) The maximum number of instances allowed in the Amazon EC2 Auto Scaling group.void
setMinSize
(Number value) The minimum number of instances allowed in the Amazon EC2 Auto Scaling group.void
setRoleArn
(String value) The Amazon Resource Name ( ARN ) for an IAM role that allows Amazon GameLift to access your Amazon EC2 Auto Scaling groups.void
setVpcSubnets
(List<String> value) A list of virtual private cloud (VPC) subnets to use with instances in the game server group.Methods inherited from class software.amazon.awscdk.core.CfnResource
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.core.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.core.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnGameServerGroup
protected CfnGameServerGroup(software.amazon.jsii.JsiiObjectRef objRef) -
CfnGameServerGroup
protected CfnGameServerGroup(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnGameServerGroup
@Stability(Stable) public CfnGameServerGroup(@NotNull Construct scope, @NotNull String id, @NotNull CfnGameServerGroupProps props) Create a newAWS::GameLift::GameServerGroup
.- Parameters:
scope
-- scope in which this resource is defined.
id
-- scoped id of the resource.
props
-- resource properties.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
-- tree inspector to collect and process attributes.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderProperties
in classCfnResource
- Parameters:
props
- This parameter is required.
-
getAttrAutoScalingGroupArn
A unique identifier for the auto scaling group. -
getAttrGameServerGroupArn
A unique identifier for the game server group. -
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getTags
A list of labels to assign to the new game server group 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 . Once the resource is created, you can use TagResource, UntagResource, and ListTagsForResource to add, remove, and view tags, respectively. The maximum tag limit may be lower than stated. See the AWS General Reference for actual tagging limits.
-
getGameServerGroupName
A developer-defined identifier for the game server group.The name is unique for each Region in each AWS account.
-
setGameServerGroupName
A developer-defined identifier for the game server group.The name is unique for each Region in each AWS account.
-
getInstanceDefinitions
The set of Amazon EC2 instance types that Amazon GameLift FleetIQ can use when balancing and automatically scaling instances in the corresponding Auto Scaling group. -
setInstanceDefinitions
The set of Amazon EC2 instance types that Amazon GameLift FleetIQ can use when balancing and automatically scaling instances in the corresponding Auto Scaling group. -
setInstanceDefinitions
The set of Amazon EC2 instance types that Amazon GameLift FleetIQ can use when balancing and automatically scaling instances in the corresponding Auto Scaling group. -
getRoleArn
The Amazon Resource Name ( ARN ) for an IAM role that allows Amazon GameLift to access your Amazon EC2 Auto Scaling groups. -
setRoleArn
The Amazon Resource Name ( ARN ) for an IAM role that allows Amazon GameLift to access your Amazon EC2 Auto Scaling groups. -
getAutoScalingPolicy
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. -
setAutoScalingPolicy
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. -
setAutoScalingPolicy
@Stability(Stable) public void setAutoScalingPolicy(@Nullable CfnGameServerGroup.AutoScalingPolicyProperty value) 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. -
getBalancingStrategy
Indicates how Amazon 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.
-
setBalancingStrategy
Indicates how Amazon 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.
-
getDeleteOption
The type of delete to perform.To delete a game server group, specify the
DeleteOption
. Options include the following:SAFE_DELETE
– (default) Terminates the game server group and Amazon EC2 Auto Scaling group only when it has no game servers that are inUTILIZED
status.FORCE_DELETE
– Terminates the game server group, including all active game servers regardless of their utilization status, and the Amazon EC2 Auto Scaling group.RETAIN
– Does a safe delete of the game server group but retains the Amazon EC2 Auto Scaling group as is.
-
setDeleteOption
The type of delete to perform.To delete a game server group, specify the
DeleteOption
. Options include the following:SAFE_DELETE
– (default) Terminates the game server group and Amazon EC2 Auto Scaling group only when it has no game servers that are inUTILIZED
status.FORCE_DELETE
– Terminates the game server group, including all active game servers regardless of their utilization status, and the Amazon EC2 Auto Scaling group.RETAIN
– Does a safe delete of the game server group but retains the Amazon EC2 Auto Scaling group as is.
-
getGameServerProtectionPolicy
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.
-
setGameServerProtectionPolicy
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.
-
getLaunchTemplate
The Amazon 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 Elastic Compute Cloud 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.
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, Amazon GameLift FleetIQ uses your account's default VPC. -
setLaunchTemplate
The Amazon 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 Elastic Compute Cloud 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.
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, Amazon GameLift FleetIQ uses your account's default VPC. -
setLaunchTemplate
@Stability(Stable) public void setLaunchTemplate(@Nullable CfnGameServerGroup.LaunchTemplateProperty value) The Amazon 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 Elastic Compute Cloud 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.
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, Amazon GameLift FleetIQ uses your account's default VPC. -
getMaxSize
The maximum number of instances allowed in the Amazon EC2 Auto Scaling group.During automatic scaling events, Amazon 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.
-
setMaxSize
The maximum number of instances allowed in the Amazon EC2 Auto Scaling group.During automatic scaling events, Amazon 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.
-
getMinSize
The minimum number of instances allowed in the Amazon EC2 Auto Scaling group.During automatic scaling events, Amazon 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.
-
setMinSize
The minimum number of instances allowed in the Amazon EC2 Auto Scaling group.During automatic scaling events, Amazon 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.
-
getVpcSubnets
A list of virtual private cloud (VPC) subnets to use with instances in the game server group.By default, all Amazon 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.
-
setVpcSubnets
A list of virtual private cloud (VPC) subnets to use with instances in the game server group.By default, all Amazon 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.
-