How Amazon GameLift FleetIQ works
The Amazon 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, Amazon 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 Amazon services.
When using Amazon 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 Amazon GameLift FleetIQ game server group with your Amazon EC2 and Auto Scaling resources and configuration. This action prompts Amazon 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 Amazon services. You can connect directly to instances in the group. As part of its optimization logic, Amazon 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 Amazon 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.
Amazon GameLift FleetIQ logic
The following diagram illustrates the role of Amazon 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. Amazon GameLift FleetIQ defines the best resources as those that deliver the highest game hosting viability for the lowest cost. Amazon 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.
![Amazon GameLift FleetIQ works alongside Amazon EC2](images/gsg-howitworks-logic.png)
Fill Auto Scaling group with optimal instance types
The job of the Auto Scaling group is to launch new instances and retire old instances, maintaining a collection of hosting resources and scaling it to meet your player demand. To do this, the Auto Scaling group relies on a list of your desired instance types. The job of Amazon GameLift FleetIQ is to continually check the viability of these desired instance types and update the list for the Auto Scaling group. This process is called instance balancing. It ensures that instances in the Auto Scaling group are continually refreshed so that only currently viable instance types are used at all times.
Amazon GameLift FleetIQ affects how the Auto Scaling group selects optimal instance types in the following ways:
-
It determines usage of Spot and/or On-Demand Instances. An Amazon GameLift FleetIQ game server group is configured with a balancing strategy, which influences how the Auto Scaling group uses Spot and/or On-Demand Instances. Spot Instances have lower costs due to fluctuating availability and potential interruptions, limitations that Amazon GameLift FleetIQ minimizes for game server hosting. On-Demand instances are more expensive but offer more reliable availability when you need it.
-
It limits new instances to launch on viable instance types only. A Amazon GameLift FleetIQ game server group maintains a master list of your desired instance types, The instance balancing process continually evaluates each desired instance type on the list for game hosting viability, using a prediction algorithm that looks at the instance type's recent availability and interruption rate. As a result of this evaluation, Amazon GameLift FleetIQ continually updates the Auto Scaling group's list of desired instance types to include only currently viable instances types.
-
It flags existing instances that are non-viable instance types. Amazon GameLift FleetIQ identifies existing instances in an 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
Amazon 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 Amazon 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 Amazon 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 Amazon 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 Amazon GameLift FleetIQ. Amazon 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, Amazon GameLift FleetIQ uses the following decision-making process to optimize placement with viable low-cost Spot Instances:
-
Where possible, Amazon 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.
-
Amazon 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.
-
Amazon 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 Amazon account before you set up your game hosting resources with Amazon 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. 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.
-
Amazon IAM role. An IAM role defines a set of permissions that allow limited access to Amazon resources. A trusted entity, such as another Amazon service, can assume the role and inherit its permissions. When using Amazon GameLift FleetIQ, you must provide an IAM role with a managed policy that allows Amazon GameLift FleetIQ to create and access Auto Scaling groups and EC2 instance resources in your Amazon account. IAM roles are not Region-specific.
Amazon 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 Amazon 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 Amazon 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 Amazon GameLift FleetIQ.
-
GameLift game server. A game server resource represents a game execution that is running on an instance associated with a Amazon GameLift FleetIQ game server group. This resource is created when a game server registers with Amazon GameLift FleetIQ and identifies the game server group it belongs to. Amazon 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 Amazon GameLift FleetIQ resources. They are created in your Amazon 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 Amazon 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, Amazon 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 Amazon 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.