Skip to main content

Dedicated server claim flow

Overview

This article explains the various options to claim a dedicated server from one or more fleets.

Provide an understanding of how dedicated servers are claimed from fleets.

Prerequisites

Before you begin this guide, you should complete the following:

  • Upload a dedicated server using the AMS CLI
  • Create a fleet that uses one of your dedicated server images

Claiming dedicated servers from AMS managed fleets

Now that you have a few dedicated servers running within a fleet, you would want one of these dedicated servers to be claimed by a game session in order to host it. The claim request is designed so your claim requests are submitted to one or more fleets, and never directly to a dedicated server, so that your fleet command is able to find a dedicated server that is best suited to your requirement.

One of such requirements is the region. This is because you want your dedicated server to be near the players that it hosts, so the players will have the best possible experience playing your game.

From the game client perspective, a dedicated server can be claimed either through matchmaking or by creating a game session.

From the backend perspective, claiming on AMS comes in two ways: by fleet ID and by claim keys. Both of which will be explained in detail in the following sections.

Claim by fleet ID

This simple claim flow allows you to claim a dedicated server from a fleet directly by providing a fleet ID and a region. The claim request will fail if the fleet has no capacity in the region, or the fleet ID does not exist.

Refer to the API documentation for claim by fleet ID for more information.

Claim by claim keys

This feature-rich claim flow enables you to group together a number of fleets by allowing them to share claim keys, so that all dedicated servers within these fleets are treated as the same pool for the purpose of claiming.

Your claim request body will have the following information:

{
"claimKeys": [
"string",

],
"regions": [
"string",

]
}

The fleet command will iterate through the region, and then for each region, the fleet command will try to claim a dedicated server using the provided list of claim keys, so that the dedicated server that is claimed by this claim flow will be as close to the players as possible. The claim process is roughly represented by this algorithm:

for each region in regions:
for each claimKey in claimKeys:
filteredFleetList = filterClaimKey(fleets, claimKey)
claimServer(filteredFleetList, region)

To learn more, refer to the API documentation for claim by claim keys.

note

There are no fleets associated with a claim key in a claim quest, the claim key will simply be skipped.

Assign claim keys to a fleet

In order to use claim keys to claim from a fleet, your fleet will need to be assigned claim keys first. To do so, you can navigate to one of your fleet and enter the detailed view. You can find the Claim Keys field under the Status tab. You can add more claim keys by clicking on the + Add More button or delete existing claim keys by clicking the X button next to a key.

claim keys

Example use of claim keys

Here are some example uses of claim keys that provide solutions for commonly encountered problems:

Blue/Green fleet image upgrade

When you have a newer version of a dedicated server that you want to upgrade to, without introducing any service downtime, you can use the concept of Blue/Green deployment to ensure availability while the transition happens.

Fleet v1: Fleet with an older server version
Fleet v2: Fleet with a newer server version

Assign Fleet v1 with the claimKeys ["v1"]
Assign Fleet v2 with the claimKeys ["v2"]

In the claim request, provide the following:

"claimKeys": ["v2", "v1"]

Expected result:

A server will be claimed from Fleet v2 they has a newer version of the server image first, if the fleet is still scaling out and has no available server, then the server will be claimed from Fleet v1 instead.

After Fleet v2 has fully ramped up, you can deactivate Fleet v1 to complete the upgrade process.

Canary fleet deployment

A canary fleet is a small fleet with a version of a dedicated server image that is still under testing. The idea of a canary fleet deployment is to test a new version of dedicated server image with live traffic without impacting your existing deployment.

  • Option 1

    Fleet Live: Fleet with live version of server
    Fleet Canary: Fleet with a version of server to be tested

    Assign Fleet Live with the claimKeys ["live"]
    Assign Fleet Canary with the claimKeys ["canary"]

    In the claim request:

    "claimKeys": ["canary", "live"]

    Expected result:

    A server will be claimed from the canary fleet first, and then from the live fleet if there are no resources available in the canary fleet.

  • Option 2

    Fleet Live: Fleet with live version of server
    Fleet Canary: Fleet with a version of server to be tested

    Assign Fleet Live with the claimKeys ["live"]
    Assign Fleet Canary with the claimKeys ["live"]

    In the claim request:

    "claimKeys": ["live"]

    Expected result:

    A server will be claimed from either the canary fleet or the live fleet, with no particular order enforced.

Support for multiple versions of a server

Sometimes, your game has multiple versions of game clients that only work with a specific version of a dedicated server. You can do so by categorizing your fleets into versions:

Fleet v1: Fleet with dedicated server v1
Fleet v2: Fleet with dedicated server v2

Assign Fleet v1 with the claimKeys ["v1"]
Assign Fleet v2 with the claimKeys ["v2"]

In the claim request, forward version of the dedicated server that the game client requires.

Expected result:

If v1 is provided in the claim request, only dedicated servers from Fleet v1 will be claimed. Likewise, if v2 is provided in the claim request, only dedicated servers from Fleet v2 will be claimed.