AWS for Games Blog

Hybrid game server hosting with Amazon GameLift Anywhere

To provide a low latency multiplayer experience for your players, you want to host the game sessions physically as close as possible to your players. Amazon GameLift supports 24 Regions and nine Local Zones—continually adding more support across the world. This allows you to centrally manage a global game server fleet from a single home region. In addition, you can leverage Amazon GameLift Anywhere to host game servers in any additional locations. This can be both on-premises or another cloud provider.

Benefits of a hybrid approach with Amazon GameLift Anywhere include cost savings from utilizing compute capacity you have already invested in, and the ability to provide ultra-low latency in locations where AWS infrastructure is not available.

You can use the Amazon GameLift APIs, matchmaking, and global game session placement features to seamlessly combine managed multi-location fleets and Anywhere fleets. Amazon GameLift abstracts the concepts of managed and custom locations from your game backend. This allows you to seamlessly move loads between managed and on-premises locations.

Typical reasons to leverage infrastructure outside of Amazon Web Services (AWS) for your game servers include:

  • You have existing on-premises hardware that you want to utilize to make use of the investment to the infrastructure
  • You want to have game servers in a location beyond the ones supported by AWS or Amazon GameLift to provide ultra-low latency for players in that specific area
  • You want to do a phased migration to Amazon GameLift managed locations from your existing infrastructure

Recommended Architecture

The recommended architecture for hybrid hosting on Amazon GameLift consists of a few key components:

  • A shared Amazon GameLift Queue that balances game session placement across managed and Anywhere locations
  • Utilizing the Amazon GameLift Agent with Anywhere fleets to simplify the game server process management, and allowing the use of the exact same game server build across both environments
  • Utilizing your existing on-premises configuration management and deployment tooling, or the AWS Systems Manager, to centrally manage the on-premises servers. This includes installing the Amazon GameLift Agent and downloading your game server build

In the first diagram (Figure 1), you’ll find two custom locations for Amazon GameLift Anywhere, and a single Anywhere fleet that’s utilizing those locations. An Anywhere location typically maps to a data center or a group of data centers in a geographical location. The Amazon GameLift Agent is installed on hardware on-premises to manage game servers. The agent manages the lifecycle of game server processes. Game server processes integrate with the Amazon GameLift Server SDK and register to their assigned Anywhere location. The Anywhere fleet is added as a destination to an Amazon GameLift Queue which manages session placement. Your game backend communicates with the Queue for session placement. You can optionally use the free matchmaking component FlexMatch.

Figure 1 - Game backend sending requests to Amazon GameLift Queue that balances traffic between two On-premises locations.

Figure 1 – Game backend sending requests to Amazon GameLift Queue that balances traffic between two On-premises locations.

The second diagram (Figure 2) shows how you can expand this architecture to combine a fully-managed multi-location Amazon GameLift Fleet, and an Anywhere fleet. Both are added as a destination to the same Queue. The Amazon GameLift Queue is configured to place game sessions based on the player latency information received from the backend or FlexMatch.

You can configure the Queue to place sessions prioritizing latency, cost, fleet destination or location, and can have all four attributes defined in priority order. This allows you to make sure you utilize your on-premises infrastructure first, and then expand to the cloud. Or, instead, you might decide to find the optimal location for latency first. It all depends on your priorities. The same game server build can be used across managed and Anywhere locations. The agent takes care of all the configuration required for the Amazon GameLift Server SDK.

Figure 2 - Amazon GameLift Queue balancing session placement requests between a managed multi-location fleet and an Anywhere fleet.

Figure 2 – Amazon GameLift Queue balancing session placement requests between a managed multi-location fleet and an Anywhere fleet.

Setting up your GameLift Anywhere locations

To prepare your custom on-premises location for Amazon GameLift Anywhere hosting, you first create custom locations in Amazon GameLift. Here we create two locations to represent two data centers by running the following command:

aws gamelift create-location --location-name custom-my-datacenter-location-1
aws gamelift create-location --location-name custom-my-datacenter-location-2

You then create an Amazon GameLift Anywhere fleet utilizing your custom locations.

Note: Here you define your game server binary launch path for up to 50 game server processes running on each bare metal server. In addition, you can pass CLI options to the processes.

In the example we only configure one game server process. The GameLift Agent will utilize this information to manage the processes. We create the fleet by running the following command:

aws gamelift create-fleet --name my-anyhere-fleet --compute-type ANYWHERE \
--locations '[{"Location": "custom-my-datacenter-location-1"}, {"Location": "custom-my-datacenter-location-2"}]' \
--runtime-configuration "ServerProcesses=[{LaunchPath=/local/game/mygameserver, ConcurrentExecutions=1, Parameters=-port 1935}]"

Your on-premises game servers can then register themselves to the correct location and fleet by configuring the Amazon GameLift Agent with the location and fleet-id command line options.

You can then create an Amazon GameLift Queue that routes traffic to the Anywhere fleet as seen in the prior diagrams (Figure 1 and 2). In addition, you would register your fully-managed Amazon GameLift fleet to the Queue and define your placement priority for hybrid scenarios. After this, it’s really up to you how you want to install the Amazon GameLift Agent and the game server build on your custom hardware.

You might be using a configuration management tool like Puppet or Ansible to manage your on-premises servers. These tools can be used to install the Amazon GameLift agent and your latest game server build on your hardware. In addition, the agent needs to communicate with the Amazon GameLift API’s. Your on-premises servers need to be configured with AWS access credentials for Amazon GameLift, as well as any other services you might need. This can be, for example, downloading game server builds from Amazon Simple Storage Service (Amazon S3).

A recommended tool provided by AWS to manage your on-premises hardware is AWS Systems Manager. Read how to install the SSM Agent on hybrid Linux nodes to learn how to configure your on-premises Linux servers for Systems Manager. After this, you can use features such as Run Command to apply configuration and run scripts across your on-premises fleet. To securely set up your on-premises hardware with AWS API access, you can use AWS Identity and Access Management (IAM) Roles Anywhere. You can build another secure mechanism that your servers can use to gain access to AWS access keys.

Conclusion

You can combine on-premises infrastructure with managed Amazon GameLift fleets to host a global hybrid game server fleet. We shared some best practices on how to set up your GameLift Anywhere on-premises locations. We also covered how to utilize Amazon GameLift APIs, and the Amazon GameLift Agent, for a unified experience across both environments. This approach allows you to gracefully migrate away from on-premises infrastructure, or to host a hybrid approach for long-term depending on your needs.

I3D.net is an example of a company who utilizes Amazon GameLift Anywhere for hybrid scenarios, and you can read more on their approach in this blog. If you are interested in learning how to set up managed Amazon GameLift fleets read this documentation for details.

Contact an AWS Representative to know how we can help accelerate your game development.

Juho Jantunen

Juho Jantunen

Juho is a Worldwide Principal Solutions Architect in the AWS for Games team focusing on game backend and game server hosting solutions. He has a background in the games industry and cloud technology, and has built and operated game backends on AWS for multiple titles with millions of players.