Menu
Amazon GameLift
Developer Guide (Version )

How Amazon GameLift Works

This topic provides an overview of Amazon GameLift components and how the service works to deploy your multiplayer game servers and manage player traffic.

Key Components

Setting up Amazon GameLift to host your game involves working with the following components:

  • A game server is your game's server software running in the cloud. You provide your game servers to Amazon GameLift by uploading a game build, which includes the server executables, supporting assets, libraries, and dependencies. Amazon GameLift deploys the game server as a set of server processes, each of which hosts a game session for players.

  • The Amazon GameLift service manages the virtual resources needed to host your game server processes, and makes it possible for players to connect to games. It does this by regulating resources to accommodate player activity, handling players' join requests and directing them to appropriate server processes, and enforcing rules that control which game servers can be joined. The service also collects performance data on server process health and player usage.

  • A game client is your game's software running on a player's device. It enables a player to connect to one of your game server processes on Amazon GameLift and play your game.

  • Optional game services might communicate with the Amazon GameLift service for a variety of purposes. For example, you might create a game service to act as an intermediary between game clients and servers, such as to manage matchmaking or player authentication.

See Amazon GameLift and Game Client/Server Interactions for a detailed description of how these components interact.

Configuring Computing Resources

To deploy a game server on Amazon GameLift, you create a fleet of virtual computing resources and specify how you want Amazon GameLift to use those resources to host your game. You configure the fleet to use a specific type of Amazon Elastic Compute Cloud (Amazon EC2) resource, called an instance, based on how much computing power you need for your game. When running your game server, Amazon GameLift creates and terminates instances as needed to manage capacity. (See Amazon GameLift service limits for more information on how many instances can be used with your AWS account.)

Your fleet configuration also specifies the game build to deploy, and describes how many game server processes should be run on each instance in the fleet. You'll need to balance the size and type of instance you're using against the computing requirements of the total number of server processes for an instance.

Note

Amazon GameLift supports multiple regions to optimize gaming performance for players around the world. Each fleet you set up is configured to deploy your game to a specific region, To make your game available to players in multiple regions, you must set up a separate fleet for each region. See a list of available regions for Amazon GameLift at AWS Regions and Endpoints.

You may want to assign an alias to a fleet. An alias is a convenient way to genericize how game clients connect to game servers. Because an alias can be changed to point to any fleet you want, referencing an alias ID in your client instead of a fleet ID helps you gracefully transition players from one fleet to another—without having to deploy game client updates.

Once a fleet is active, Amazon GameLift is ready to start accepting requests for new game sessions. From this point on, you can manage fleet configuration, capacity, and utilization as demand requires.

Use game session queues to manage how game sessions are created across multiple fleets running the same game server build. Queues allow you to respond to increased player demand by taking advantage of alternate fleets, including those in other regions.

Handling Capacity and Utilization

Here's how Amazon GameLift handles capacity and utilization for multiplayer game sessions in real time.

You can change a fleet's capacity at any time, increasing or decreasing the number of desired instances. When you increase capacity, Amazon GameLift immediately begins the process of starting a new instance and a new set of idle server processes, which can then host new game sessions as they are requested. This continues until the new capacity setting is reached.

When you decrease fleet capacity, a scale down event is triggered. GameLift selects instances to terminate in order to meet the reduced capacity setting. Any instance in the fleet may be terminated, regardless of whether the instance is hosting active game sessions. You can choose to avoid terminating instances with active game sessions by turning on a feature called game session protection, either for an individual game session or for an entire fleet. An instance can only be terminated when none of its server processes are hosting protected game sessions. If a scale down event is triggered but all instances in the fleet have at least one protected game session, no scale down action takes place.

In addition to setting fleet capacity to control overall usage and costs for your GameLift resources, it is also possible to control how players are allowed to consume fleet resources (that is, create new game sessions). For games where individual players can create game sessions, you can add a resource creation limit policy to a fleet to restrict the number of game sessions that any one player can create over a span of time.

Automatic Scaling

Automatic scaling simply automates the process of increasing or decreasing capacity, enabling the fleet to quickly accommodate changes in player demand. Usage peaks and valleys can fluctuate unpredictably, making it difficult to manually adjust capacity that strikes a balance between maintaining enough fleet capacity to accommodate incoming players and avoiding paying for unused resources during idle times.

The goal of automatic scaling is to have Amazon GameLift change capacity on the fly in response to player demand. Automatic scaling is a set of rules, based on actual player activity, that you define to tell Amazon GameLift when to increase or reduce capacity. With the right rules in place, Amazon GameLift can maintain a capacity level that always has room for new players without running idle servers. Automatic scaling rules, called policies, are based on certain Amazon GameLift metrics that track player utilization. These include the number of current players, the number of available player slots, and the number of idle instances, as well as others.

An automatic scaling policy statement takes the following form: "If a specified metric hits or exceeds a specified threshold value for a specified number of minutes, then change fleet capacity a specified amount." So, for example, you might decide to use available player slots as an indicator of when demand is spiking up: "If the number of available player slots falls below 50 for more than 10 consecutive minutes, then increase capacity by 1 instance."

A fleet can have multiple policies in force; each one is evaluated independently. For example, you might have a policy that tells Amazon GameLift to decrease capacity by 10% if the number of idle instances is more than 5 for 15 minutes. If you also have a policy to decrease capacity based on number of available player slots, both policies can be triggered as demand decreases. A more common scenario is to have a set of policies, each of which responds to either increasing demand or decreasing demand.

Automatic scaling and game session protection work together to ensure that players are not arbitrarily dropped as Amazon GameLift automatically adjusts capacity and takes down unneeded game servers to save you money. If automatic scaling triggers a scale down but all available instances are hosting active game sessions and are protected, the scale down fails and capacity does not change. However, the policy will continue to be evaluated with each metric report; if it continues to trigger a scale down, one will occur the next time a game session ends. As a result, capacity is automatically adjusted without affecting active players.

Monitoring Fleet Activity and Troubleshooting

Once you have fleets up and running, Amazon GameLift collects a variety of information to help you monitor the performance of your deployed game servers. Use this information to optimize your use of resources, troubleshoot issues, and gain insight into how players are active in your games.

  • Fleet, game session, and player session details – This data includes status, which can help identify health issues, as well as details such as game session length and player connection time.

  • Utilization metrics – Amazon GameLift tracks fleet metrics over time:

    • For instances: network activity and CPU utilization

    • For server processes: number of active processes, new activations, and terminations

    • For games and players: number of active game sessions and player sessions

  • Server process health – Amazon GameLift tracks the health of each server process running on a fleet, including the number of healthy processes, percent of active processes that are healthy, and number of abnormal terminations.

  • Game session logs – You can have your game servers log session data and set Amazon GameLift to collect and store the logs once the game session ends. Logs can then be downloaded from the service.

All of this data is available through the Amazon GameLift console. The console dashboard presents an overview of activity across all you builds and fleets as well as the option to drill down to more detailed information.

Networking With AWS Resources

If your game server communicates with other resources that are hosted on AWS, you can use Amazon Virtual Private Cloud (VPC) peering to establish fast and secure connections. An Amazon VPC is a virtual network, defined by you, that includes a set of resources managed with your AWS account. In addition, each Amazon GameLift fleet, including the game server processes running on each instance in the fleet, has its own VPC. With VPC peering, you can establish a direct network connection between a VPC for your game server processes and a VPC for your other AWS resources.

For example, you might have a set of web services that support your game, such as for player authentication or social networking. You can set up a VPC for these resources, and then use Amazon GameLift’s VPC peering feature to enable your game servers to make direct network calls to the web services. With VPC peering, calls from your game server processes incur minimal latency and, since they are not routed over the public Internet, are not exposed externally.

See more information on Amazon’s virtual private clouds and VPC peering. You can peer your Amazon GameLift fleets with VPCs in any AWS account that you have access to.

Amazon GameLift streamlines the process of setting up VPC peering connections for your game servers. It handles peering requests, updates route tables, and configures the connections as required. For more information on how to set up VPC peering for your game servers, see Set Up VPC Peering.