

# Manage Amazon GameLift Servers FleetIQ game server groups
Manage game server groups

This topic describes the tasks required to set up a Amazon GameLift Servers FleetIQ game server group. Creating a game server group triggers the creation of an EC2 Auto Scaling group with all the necessary configuration settings, along with configuration to manage Amazon GameLift Servers FleetIQ optimizations for game hosting.

Before you can create a game server group, you must at minimum have the following resources prepared: 
+ 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](https://docs.amazonaws.cn/AWSEC2/latest/UserGuide/ec2-launch-templates.html) in the *Amazon EC2 User Guide*.
+ An IAM role that extends limited access to your Amazon account to allow Amazon GameLift Servers FleetIQ to create and interact with the Auto Scaling group. For more information, see [Create IAM roles for cross-service interaction](gsg-iam-permissions-roles.md).

# Create a game server group


To create a game server group, call [CreateGameServerGroup()](https://docs.amazonaws.cn/gamelift/latest/apireference/API_CreateGameServerGroup.html). This operation creates both a Amazon GameLift Servers FleetIQ game server group and a corresponding Auto Scaling group. When you create the game server group, you provide game-specific settings for Amazon GameLift Servers FleetIQ, including balancing strategy and instance type definitions. You also provide initial property settings for the Auto Scaling group.

The following example triggers the creation of a `GameServerGroup` that specifies c4.large and c5.large instance types and limits the group to Spot Instances only, and an Auto Scaling group that uses the specified launch template for deploying instances and manages group capcity within the minimum and maximum settings using a target-tracking automatic scaling policy. After a short provisioning period, an `AutoScalingGroup` resource is created, and the `GameServerGroup` enters an ACTIVE state.

```
Amazon gamelift create-game-server-group \
    --game-server-group-name MyLiveGroup \
    --role-arn arn:aws:iam::123456789012:role/GameLiftGSGRole \
    --min-size 1 \
    --max-size 10 \
    --game-server-protection-policy FULL_PROTECTION \
    --balancing-strategy SPOT_ONLY \
    --launch-template LaunchTemplateId=lt-012ab345cde6789ff \
    --instance-definitions '[{"InstanceType": "c4.large"}, {"InstanceType": "c5.large"}]' \
    --auto-scaling-policy '{"TargetTrackingConfiguration": {"TargetValue": 66}}'
```

# Update a game server group


You can update game server group properties that affect how Amazon GameLift Servers FleetIQ manages hosting for game servers, including resource type optimizations. To update these properties, call [UpdateGameServerGroup()](https://docs.amazonaws.cn/gamelift/latest/apireference/API_UpdateGameServerGroup.html). After the changes to the game server group take effect, Amazon GameLift Servers FleetIQ may overwrite certain properties in the Auto Scaling group. 

For all other Auto Scaling group properties, such as `MinSize`, `MaxSize`, and `LaunchTemplate`, you can modify these directly on the Auto Scaling group. 

In the example below, the instance type definitions are updated to switch over to c4.xlarge and c5.xlarge instances types.

```
Amazon gamelift update-game-server-group \
    --game-server-group-name MyLiveGroup \
    --instance-definitions '[{"InstanceType": "c4.xlarge"}, {"InstanceType": "c5.xlarge"}]'
```

# Track game server group instances


After you create and deploy instances to your game server group and Auto Scaling group, you can track the status of game server instances by calling [DescribeGameServerInstances()](https://docs.amazonaws.cn/gamelift/latest/apireference/API_DescribeGameServerInstances.html). You can use this operation to track instance status.. For more information on game server group status, see [Life of a game server group](gsg-howitworks-lifecycle-gameservergroup.md). 

You can also use the [Amazon GameLift Servers console](https://console.amazonaws.cn/gamelift/), under **Game server groups**, to monitor the status of your game server groups.