Configures an advanced GameLift game server group with auto scaling, multiple instance types, and specific subnet deployments.

Terraform Template

resource "aws_gamelift_game_server_group" "example" {

  auto_scaling_policy {
    estimated_instance_warmup = 60

    target_tracking_configuration {
      target_value = 75
    }
  }
  balancing_strategy = "SPOT_ONLY"
  depends_on = ["aws_iam_role_policy_attachment.example"]
  game_server_group_name = "example"
  game_server_protection_policy = "FULL_PROTECTION"

  instance_definition {
    instance_type = "c5.large"
    weighted_capacity = "1"
  }

  instance_definition {
    instance_type = "c5.2xlarge"
    weighted_capacity = "2"
  }

  launch_template {
    id = "aws_launch_template.example.id"
    version = "1"
  }
  max_size = 1
  min_size = 1
  role_arn = "aws_iam_role.example.arn"

  tags = {
    Name = "example"
  }
  vpc_subnets = ["subnet-12345678", "subnet-23456789"]
}