How GameLift FleetIQ works - Amazon GameLift

How GameLift FleetIQ works

The GameLift FleetIQ solution is a game hosting layer that supplements the full set of computing resource management tools that you get with Amazon EC2 and Auto Scaling. In addition to offering a slate of features specific to game hosting, GameLift FleetIQ provides an extra layer of logic that makes it possible to use low-cost Spot Instances for game hosting. This solution lets you directly manage your Amazon EC2 and Auto Scaling resources and integrate as needed with other AWS services.

When using GameLift FleetIQ, you prepare to launch Amazon EC2 instances as usual: make an Amazon Machine Image (AMI) with your game server software, create an Amazon EC2 launch template, and define configuration settings for an Auto Scaling group. However, instead of creating an Auto Scaling group directly, you create a GameLift FleetIQ game server group with your Amazon EC2 and Auto Scaling resources and configuration. This action prompts GameLift FleetIQ to create both a game server group and a corresponding Auto Scaling group. The game server group is linked to and manages certain aspects of the Auto Scaling group.

After the Auto Scaling group is created, you have full access to your Amazon EC2 and Auto Scaling resources. You can change the configuration of your Auto Scaling groups, add multi-level scaling policies or load balancers, and integrate with other AWS services. You can connect directly to instances in the group. As part of its optimization logic, GameLift FleetIQ also makes periodic updates to certain Auto Scaling group properties. You can track the availability status of all instances deployed by the Auto Scaling group.

You can temporarily suspend GameLift FleetIQ activity for a game server group at any time. You also have the option to delete a game server group but retain the corresponding Auto Scaling group.

GameLift FleetIQ logic

The following diagram illustrates the role of GameLift FleetIQ when it is working with Amazon EC2 for game hosting. Its primary goal is to locate the best possible game server to host a game session and give players an optimal gameplay experience. GameLift FleetIQ defines the best resources as those that deliver the highest game hosting viability for the lowest cost. GameLift FleetIQ approaches this goal in two key ways: first by allowing only viable instance types in the Auto Scaling group, and second by placing new game sessions effectively across the group's available resources.


                    GameLift FleetIQ works alongside Amazon EC2

Fill Auto Scaling group with optimal instance types

The Auto Scaling group's job is to launch new instances and retire old instances, maintaining a collection of hosting resources and scaling it to meet your player demand. When you create a game server group, you define a list of instance types for the Auto Scaling group to use. The job of GameLift FleetIQ is to continually check the viability of your desired instance types and update this list for the Auto Scaling group. With this process, called instance balancing, GameLift FleetIQ ensures that new instances are launched only with currently viable instance types, and existing instances on nonviable instance types are retired and replaced. GameLift FleetIQ affects how the Auto Scaling group selects optimal instance types in the following ways:

  • A GameLift FleetIQ game server group is configured with a balancing strategy, which determines whether the Auto Scaling group uses Spot or On-Demand Instances. Spot Instances have lower costs due to fluctuating availability and potentialinterruptions, limitations that GameLift FleetIQ minimizes for game server hosting. On-Demand instances, although more costly, give you more reliable availability when you need it.

  • GameLift FleetIQ instance balancing process evaluates the viability for game hosting of each desired instance type of the game server group. This process uses a prediction algorithm that evaluates the instance type's recent availability and interruption rate. If the chance of game server interruption is too high, GameLift FleetIQ removes this non-viable instance type from the Auto Scaling group's list of desired instance types.

  • GameLift FleetIQ identifies existing instances in the Auto Scaling group that are currently non-viable instance types. These instances are flagged as draining, which means they are terminated and replaced with new instances. For instances that have game server protection turned on, termination is postponed until any active game sessions end normally.

As the Auto Scaling group launches and retires instances, it maintains a collection that is optimized for game hosting even as the availability of low-cost Spot Instance types fluctuates. Balancing activity takes place on game server groups with active instances only. Learn more about how this process works in Spot balancing process.

Place game sessions effectively

GameLift FleetIQ tracks all active game servers in the game server group and uses this information to determine the best placement for new game sessions and players.

To enable GameLift FleetIQ to track game servers, your game server software must report its status. Your custom AMI controls how new game servers processes are started and stopped on each instance. When a new game server is started, it registers with GameLift FleetIQ, indicating that it is ready to host a game session. After registering, the game server periodically reports its health and whether it is currently hosting a game session. When the game server shuts down, it de-registers with GameLift FleetIQ.

To start a new game session, your game client (or matchmaker or other client service) sends a request for a game server to GameLift FleetIQ. GameLift FleetIQ locates an available game server, claims it for the new game session, and responds with the game server ID and connection info. Your game then prompts the game server to update its status and start a new game session for incoming players.

When selecting a game server to host a new game session, GameLift FleetIQ uses the following decision-making process to optimize placement with viable low-cost Spot Instances:

  1. Where possible, GameLift FleetIQ places new game sessions on instances that are already hosting other game sessions. By packing (but not overloading) some instances and keeping others idle, the Auto Scaling group is able to quickly scale down idle instances when they're not needed, which lowers hosting costs.

  2. GameLift FleetIQ ignores instances that are flagged as draining, that is, not viable for game hosting. These instances are kept running only to support existing game sessions. They can't be used for new game sessions unless no other game servers are available.

  3. GameLift FleetIQ identifies all available game servers that are running on viable instances.

You can turn on game session protection for a game server group to prevent the Auto Scaling group from terminating instances with actively running game sessions.

Key resources and components

Create the following resources in your AWS account before you set up your game hosting resources with GameLift FleetIQ. As a best practice, develop and test your game server deployment with these resources before using them through a game server group.

  • Amazon Machine Image (AMI). An AMI is a template for a specific software configuration that you want to launch with your Amazon EC2 instances. For game hosting, your AMI includes an operating system, your game server binaries or container, and other runtime software that your game server requires. For more information about creating an AMI, refer to Amazon Machine Images in the Amazon EC2 User Guide for Linux Instances. AMIs are Region-specific. You can copy an AMI from one Region to another, as described in Copying AMIs in the Amazon EC2 User Guide.

  • Amazon EC2 launch template. A launch template provides instructions for launching and managing instances in an Auto Scaling group. It specifies an AMI, provides a list of suitable instance types, and sets network, security, and other properties. For more information about creating a launch template, see Launching an Instance from a Launch Template in the Amazon EC2 User Guide. Launch templates are Region-specific.

  • AWS IAM role. An IAM role defines a set of permissions that allow limited access to AWS resources. A trusted entity, such as another AWS service, can assume the role and inherit its permissions. When using GameLift FleetIQ, you must provide an IAM role with a managed policy that allows GameLift FleetIQ to create and access Auto Scaling groups and EC2 instance resources in your AWS account. IAM roles are not Region-specific.

GameLift FleetIQ manages the following resources directly and has direct authority over them.

  • GameLift game server group. A game server group contains configuration settings that define how GameLift FleetIQ works with a corresponding Auto Scaling group to deliver low-cost game hosting. Game server groups are Region-specfic. When you create a game server group in a Region, a new Auto Scaling group is automatically created in your AWS account in the same Region. The game server group is linked to the Auto Scaling group and has access (by assuming the IAM role) to manage and modify some of its settings. A game server group is a long-lived resource; developers should expect to create them infrequently. A game server group is also a functional grouping resource for game servers that are hosted on instances in the Auto Scaling group and registered with GameLift FleetIQ.

  • GameLift game server. A game server resource represents a game execution that is running on an instance associated with a GameLift FleetIQ game server group. This resource is created when a game server registers with GameLift FleetIQ and identifies the game server group it belongs to. GameLift FleetIQ tracks the utilization status and claim status of each registered game server, which enables it to monitor game server availability. Game servers are Region-specific in that they are associated with a Region-specific game server group. When your game requests a new game server, it specifies the game server group and Region.

These resources are created through GameLift FleetIQ resources. They are created in your AWS account and you have full control of them.

  • Amazon EC2 Auto Scaling group. An Auto Scaling group launches and manages a collection of EC2 instances, and automatically scales group capacity. With GameLift FleetIQ, there is a one-to-one relationship between the game server group and the Auto Scaling group. While you can update all settings for an Auto Scaling group, GameLift FleetIQ periodically overrides and updates certain settings as part of its logic to balance Spot Instances for game hosting viability. For more information, see AutoScalingGroup in the Amazon EC2 Auto Scaling User Guide. Auto Scaling groups are Region-specific; they are created in the same Region as the game server group.

  • Amazon EC2 Instance. An instance is a virtual server in the cloud. Instance types have specific hardware configurations that specify compute, memory, disk, and network resources. They are typically launched by an Auto Scaling group with an AMI. Instances can be Spot or On-Demand, depending on availability. With GameLift FleetIQ, instances run one or multiple game server processes, each of which can host multiple game sessions. Instances are Region-specific in that they are associated with a Region-specific Auto Scaling group.