Class: AWSCDK::GameLift::CfnGameServerGroupProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
game_lift/cfn_game_server_group_props.rb

Overview

Properties for defining a CfnGameServerGroup.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(game_server_group_name:, instance_definitions:, role_arn:, auto_scaling_policy: nil, balancing_strategy: nil, delete_option: nil, game_server_protection_policy: nil, launch_template: nil, max_size: nil, min_size: nil, tags: nil, vpc_subnets: nil) ⇒ CfnGameServerGroupProps

Returns a new instance of CfnGameServerGroupProps.

Parameters:

  • game_server_group_name (String)

    A developer-defined identifier for the game server group.

  • instance_definitions (AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::GameLift::CfnGameServerGroup::InstanceDefinitionProperty>)

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

  • role_arn (String)

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

  • auto_scaling_policy (AWSCDK::IResolvable, AWSCDK::GameLift::CfnGameServerGroup::AutoScalingPolicyProperty, nil) (defaults to: nil)

    Configuration settings to define a scaling policy for the Auto Scaling group that is optimized for game hosting.

  • balancing_strategy (String, nil) (defaults to: nil)

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

  • delete_option (String, nil) (defaults to: nil)

    The type of delete to perform.

  • game_server_protection_policy (String, nil) (defaults to: nil)

    A flag that indicates whether instances in the game server group are protected from early termination.

  • launch_template (AWSCDK::IResolvable, AWSCDK::GameLift::CfnGameServerGroup::LaunchTemplateProperty, nil) (defaults to: nil)

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

  • max_size (Numeric, nil) (defaults to: nil)

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

  • min_size (Numeric, nil) (defaults to: nil)

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

  • tags (Array<AWSCDK::CfnTag>, nil) (defaults to: nil)

    A list of labels to assign to the new game server group resource.

  • vpc_subnets (Array<String>, nil) (defaults to: nil)

    A list of virtual private cloud (VPC) subnets to use with instances in the game server group.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'game_lift/cfn_game_server_group_props.rb', line 21

def initialize(game_server_group_name:, instance_definitions:, role_arn:, auto_scaling_policy: nil, balancing_strategy: nil, delete_option: nil, game_server_protection_policy: nil, launch_template: nil, max_size: nil, min_size: nil, tags: nil, vpc_subnets: nil)
  @game_server_group_name = game_server_group_name
  Jsii::Type.check_type(@game_server_group_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "gameServerGroupName")
  @instance_definitions = instance_definitions
  Jsii::Type.check_type(@instance_definitions, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZ2FtZWxpZnQuQ2ZuR2FtZVNlcnZlckdyb3VwLkluc3RhbmNlRGVmaW5pdGlvblByb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "instanceDefinitions")
  @role_arn = role_arn
  Jsii::Type.check_type(@role_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "roleArn")
  @auto_scaling_policy = auto_scaling_policy.is_a?(Hash) ? ::AWSCDK::GameLift::CfnGameServerGroup::AutoScalingPolicyProperty.new(**auto_scaling_policy.transform_keys(&:to_sym)) : auto_scaling_policy
  Jsii::Type.check_type(@auto_scaling_policy, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19nYW1lbGlmdC5DZm5HYW1lU2VydmVyR3JvdXAuQXV0b1NjYWxpbmdQb2xpY3lQcm9wZXJ0eSJ9XX19")), "autoScalingPolicy") unless @auto_scaling_policy.nil?
  @balancing_strategy = balancing_strategy
  Jsii::Type.check_type(@balancing_strategy, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "balancingStrategy") unless @balancing_strategy.nil?
  @delete_option = delete_option
  Jsii::Type.check_type(@delete_option, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "deleteOption") unless @delete_option.nil?
  @game_server_protection_policy = game_server_protection_policy
  Jsii::Type.check_type(@game_server_protection_policy, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "gameServerProtectionPolicy") unless @game_server_protection_policy.nil?
  @launch_template = launch_template.is_a?(Hash) ? ::AWSCDK::GameLift::CfnGameServerGroup::LaunchTemplateProperty.new(**launch_template.transform_keys(&:to_sym)) : launch_template
  Jsii::Type.check_type(@launch_template, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19nYW1lbGlmdC5DZm5HYW1lU2VydmVyR3JvdXAuTGF1bmNoVGVtcGxhdGVQcm9wZXJ0eSJ9XX19")), "launchTemplate") unless @launch_template.nil?
  @max_size = max_size
  Jsii::Type.check_type(@max_size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxSize") unless @max_size.nil?
  @min_size = min_size
  Jsii::Type.check_type(@min_size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minSize") unless @min_size.nil?
  @tags = tags.is_a?(Array) ? tags.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CfnTag.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : tags
  Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkNmblRhZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "tags") unless @tags.nil?
  @vpc_subnets = vpc_subnets
  Jsii::Type.check_type(@vpc_subnets, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "vpcSubnets") unless @vpc_subnets.nil?
end

Instance Attribute Details

#auto_scaling_policyAWSCDK::IResolvable, ... (readonly)

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.



71
72
73
# File 'game_lift/cfn_game_server_group_props.rb', line 71

def auto_scaling_policy
  @auto_scaling_policy
end

#balancing_strategyString? (readonly)

Indicates how Amazon GameLift Servers 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.


82
83
84
# File 'game_lift/cfn_game_server_group_props.rb', line 82

def balancing_strategy
  @balancing_strategy
end

#delete_optionString? (readonly)

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 in UTILIZED 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.


93
94
95
# File 'game_lift/cfn_game_server_group_props.rb', line 93

def delete_option
  @delete_option
end

#game_server_group_nameString (readonly)

A developer-defined identifier for the game server group.

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



54
55
56
# File 'game_lift/cfn_game_server_group_props.rb', line 54

def game_server_group_name
  @game_server_group_name
end

#game_server_protection_policyString? (readonly)

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.



100
101
102
# File 'game_lift/cfn_game_server_group_props.rb', line 100

def game_server_protection_policy
  @game_server_protection_policy
end

#instance_definitionsAWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::GameLift::CfnGameServerGroup::InstanceDefinitionProperty> (readonly)

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



59
60
61
# File 'game_lift/cfn_game_server_group_props.rb', line 59

def instance_definitions
  @instance_definitions
end

#launch_templateAWSCDK::IResolvable, ... (readonly)

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 Servers FleetIQ uses your account's default VPC.



109
110
111
# File 'game_lift/cfn_game_server_group_props.rb', line 109

def launch_template
  @launch_template
end

#max_sizeNumeric? (readonly)

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

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



116
117
118
# File 'game_lift/cfn_game_server_group_props.rb', line 116

def max_size
  @max_size
end

#min_sizeNumeric? (readonly)

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

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



123
124
125
# File 'game_lift/cfn_game_server_group_props.rb', line 123

def min_size
  @min_size
end

#role_arnString (readonly)

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



64
65
66
# File 'game_lift/cfn_game_server_group_props.rb', line 64

def role_arn
  @role_arn
end

#tagsArray<AWSCDK::CfnTag>? (readonly)

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.



130
131
132
# File 'game_lift/cfn_game_server_group_props.rb', line 130

def tags
  @tags
end

#vpc_subnetsArray<String>? (readonly)

A list of virtual private cloud (VPC) subnets to use with instances in the game server group.

By default, all Amazon GameLift Servers 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.



137
138
139
# File 'game_lift/cfn_game_server_group_props.rb', line 137

def vpc_subnets
  @vpc_subnets
end

Class Method Details

.jsii_propertiesObject



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'game_lift/cfn_game_server_group_props.rb', line 139

def self.jsii_properties
  {
    :game_server_group_name => "gameServerGroupName",
    :instance_definitions => "instanceDefinitions",
    :role_arn => "roleArn",
    :auto_scaling_policy => "autoScalingPolicy",
    :balancing_strategy => "balancingStrategy",
    :delete_option => "deleteOption",
    :game_server_protection_policy => "gameServerProtectionPolicy",
    :launch_template => "launchTemplate",
    :max_size => "maxSize",
    :min_size => "minSize",
    :tags => "tags",
    :vpc_subnets => "vpcSubnets",
  }
end

Instance Method Details

#to_jsiiObject



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'game_lift/cfn_game_server_group_props.rb', line 156

def to_jsii
  result = {}
  result.merge!({
    "gameServerGroupName" => @game_server_group_name,
    "instanceDefinitions" => @instance_definitions,
    "roleArn" => @role_arn,
    "autoScalingPolicy" => @auto_scaling_policy,
    "balancingStrategy" => @balancing_strategy,
    "deleteOption" => @delete_option,
    "gameServerProtectionPolicy" => @game_server_protection_policy,
    "launchTemplate" => @launch_template,
    "maxSize" => @max_size,
    "minSize" => @min_size,
    "tags" => @tags,
    "vpcSubnets" => @vpc_subnets,
  })
  result.compact
end