The AWS::GameLift::GameServerGroup resource creates an Amazon GameLift (GameLift) GameServerGroup.
IMPORTANT: Amazon GameLift Game Server Groups can take some time to finish activating. This can lead to a long-running (>25min) terraform apply
and is normal.
If you encounter errors with your game server group not activating successfully, check the troubleshooting steps listed in
this doc as well as the required IAM cross-account
roles documented here.
To use awscc_gamelift_game_server_group to create a GameLift FleetIQ Game Server Group:
resource "awscc_gamelift_game_server_group" "example_server_group" {
game_server_group_name = "example-game-server-group"
instance_definitions = [
{ instance_type = "c5.large" },
{ instance_type = "c6g.xlarge" }
]
role_arn = awscc_iam_role.example_iam_role.arn
min_size = "1"
max_size = "3"
launch_template = {
launch_template_id = awscc_ec2_launch_template.gamelift_launch_template.id
}
}
resource "awscc_iam_role" "example_iam_role" {
role_name = "example_gamelift_iam_role"
description = "This IAM role grants Amazon GameLift GameServerGroup to manage GameLift EC2 Fleet."
assume_role_policy_document = data.aws_iam_policy_document.instance_assume_role_policy.json
managed_policy_arns = ["arn:aws:iam::aws:policy/GameLiftGameServerGroupPolicy"]
max_session_duration = 7200
path = "/"
tags = [
{
key = "Modified By"
value = "AWSCC"
}
]
}
resource "awscc_ec2_launch_template" "gamelift_launch_template" {
launch_template_data = {
image_id = data.aws_ami.amazon_linux.id
}
launch_template_name = "gamelift_launch_template"
}
data "aws_iam_policy_document" "instance_assume_role_policy" {
statement {
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["gamelift.amazonaws.com", "autoscaling.amazonaws.com"]
}
}
}
data "aws_ami" "amazon_linux" {
most_recent = true
owners = ["amazon"]
filter {
name = "name"
values = ["amzn2-ami-hvm-*-gp2"]
}
filter {
name = "root-device-type"
values = ["ebs"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
filter {
name = "architecture"
values = ["x86_64"]
}
}
game_server_group_name
(String) An identifier for the new game server group.instance_definitions
(Attributes List) A set of EC2 instance types to use when creating instances in the group. (see below for nested schema)role_arn
(String) The Amazon Resource Name (ARN) for an IAM role that allows Amazon GameLift to access your EC2 Auto Scaling groups.auto_scaling_policy
(Attributes) Configuration settings to define a scaling policy for the Auto Scaling group that is optimized for game hosting. Updating this game server group property will not take effect for the created EC2 Auto Scaling group, please update the EC2 Auto Scaling group directly after creating the resource. (see below for nested schema)balancing_strategy
(String) The fallback balancing method to use for the game server group when Spot Instances in a Region become unavailable or are not viable for game hosting.delete_option
(String) The type of delete to perform.game_server_protection_policy
(String) A flag that indicates whether instances in the game server group are protected from early termination.launch_template
(Attributes) The EC2 launch template that contains configuration settings and game server code to be deployed to all instances in the game server group. Updating this game server group property will not take effect for the created EC2 Auto Scaling group, please update the EC2 Auto Scaling group directly after creating the resource. (see below for nested schema)max_size
(Number) The maximum number of instances allowed in the EC2 Auto Scaling group. Updating this game server group property will not take effect for the created EC2 Auto Scaling group, please update the EC2 Auto Scaling group directly after creating the resource.min_size
(Number) The minimum number of instances allowed in the EC2 Auto Scaling group. Updating this game server group property will not take effect for the created EC2 Auto Scaling group, please update the EC2 Auto Scaling group directly after creating the resource.tags
(Attributes List) A list of labels to assign to the new game server group resource. Updating game server group tags with CloudFormation will not take effect. Please update this property using AWS GameLift APIs instead. (see below for nested schema)vpc_subnets
(List of String) A list of virtual private cloud (VPC) subnets to use with instances in the game server group. Updating this game server group property will not take effect for the created EC2 Auto Scaling group, please update the EC2 Auto Scaling group directly after creating the resource.auto_scaling_group_arn
(String) A generated unique ID for the EC2 Auto Scaling group that is associated with this game server group.game_server_group_arn
(String) A generated unique ID for the game server group.id
(String) Uniquely identifies the resource.instance_definitions
Required:
instance_type
(String) An EC2 instance type designation.Optional:
weighted_capacity
(String) Instance weighting that indicates how much this instance type contributes to the total capacity of a game server group.auto_scaling_policy
Required:
target_tracking_configuration
(Attributes) Settings for a target-based scaling policy applied to Auto Scaling group. (see below for nested schema)Optional:
estimated_instance_warmup
(Number) Length of time, in seconds, it takes for a new instance to start new game server processes and register with GameLift FleetIQ.auto_scaling_policy.target_tracking_configuration
Required:
target_value
(Number) Desired value to use with a game server group target-based scaling policy.launch_template
Optional:
launch_template_id
(String) A unique identifier for an existing EC2 launch template.launch_template_name
(String) A readable identifier for an existing EC2 launch template.version
(String) The version of the EC2 launch template to use.tags
Optional:
key
(String) The key for a developer-defined key:value pair for tagging an AWS resource.value
(String) The value for a developer-defined key:value pair for tagging an AWS resource.Import is supported using the following syntax:
$ terraform import awscc_gamelift_game_server_group.example <resource ID>