Create a Amazon GameLift container fleet - Amazon GameLift

Create a Amazon GameLift container fleet

This documentation is for a feature that is in public preview release. It is subject to change.

When you've created your container group definitions, use the Amazon GameLift console or the AWS Command Line Interface (AWS CLI) to create a container fleet.

After you create a new fleet, the fleet's status passes through several stages as Amazon GameLift deploys your container groups onto each fleet instance and starts the game servers. When the fleet reaches status ACTIVE, it's ready to host game sessions. For help with fleet creation issues, see Debug Amazon GameLift fleet issues.

Console

In the Amazon GameLift console, select the AWS Region where you want to create the fleet. The container group definitions must be in the same region where you want to create the fleet.

Open the console’s left navigation bar and choose Fleets. On the Fleets page, choose Create fleet.

Step 1: Choose compute type
  • Choose the Containers compute type.

Step 2: Define fleet details
  1. In the Fleet details section, enter a fleet name and description.

  2. In the Container group details section, identify the container groups to deploy to the fleet. You must add a replica container group. You can optionally add a daemon container group. Each group must be in status READY.

  3. Set the Connection port range for the fleet. For more details, see Configure network connections.

  4. Optionally specify the Desired replicas per instance to deploy. You can specify a desired number or you can let Amazon GameLift calculate the maximum possible number. If you specify a desired number that's larger than the calculated maximum, fleet creation will fail. You can't change this setting after the fleet is created. For more details on replica container group packing, see Core concepts.

  5. (Optional) Under Additional details:

    1. For Instance role, specify an IAM role that authorizes applications in your game build to access other AWS resources in your account. For more information, see Communicate with other AWS resources from your fleets. To create a fleet with an instance role, your account must have the IAM PassRole permission. For more information, see IAM permission examples for Amazon GameLift.

    2. For Metric group, Enter the name of a new or existing fleet metric group. You can aggregate the metrics for multiple fleets by adding them to the same metric group.

Step 3: Define instance details
  1. In Instance deployment, select one or more remote locations to deploy instances to. The home Region is automatically selected (this is the Region that you're creating the fleet in). If you select additional locations, fleet instances are also deployed in these locations.

    Important

    To use Regions that aren't enabled by default, enable them in your AWS account.

    • Fleets with Regions that aren't enabled that you created before February 28, 2022 are unaffected.

    • To create new multi-location fleets or to update existing multi-location fleets, first enable any Regions that you choose to use.

    For more information about Regions that aren't enabled by default and how to enable them, see Managing AWS Regions in the AWS General Reference.

  2. Select an Instance configuration for the fleet. The console automatically calculates the minimum vCPU and memory required (based on the total limits you set for each container group). It filters the complete list of available instance types base on resource requirements and the locations you entered. You can add additional filters as needed.

    For more information about choosing an instance type, see Configure a container fleet. The size of the instance type you choose will impact how replica container groups are packed onto each fleet instance. Depending on your choice, consider reviewing your setting for desired replicas per instance.

Step 4: Configure runtime

The runtime configuration determines how game server processes are started and run. These instructions are passed to the Amazon GameLift Agent, which implements them in the same way in each replica container group. You can update a fleet's runtime configuration by calling UpdateRuntimeConfiguration.

  1. For Launch path, enter the path to a game executable.

  2. (Optional) For Launch parameters, enter information to pass to your game executable as a set of command line parameters.

  3. Specify the number of Concurrent processes to maintain running in each replica container group. Review the Amazon GameLift quotas on the number of server processes per instance. Limits on concurrent server processes per instance apply to the total of concurrent processes for all configurations. If you configure the fleet to exceed the limit, the fleet can't activate.

  4. Set optional limits on concurrent Game session activations. These settings let you limit the amount of resources that are consumed when starting a new game session. Game session activations can have an performance impact on existing game sessions.

  5. Set EC2 port settings to allow external traffic to gain access to processes that are running on the fleet. Specify some or all the connection ports numbers that are defined for the fleet. You don't have to set these ports when you create the fleet, but without them no traffic can connect to your game servers. To update a fleet's port settings later, call UpdateFleetPortSettings

  6. Under Game session resource settings configure the following optional features:

    1. Turn Game scaling protection policy on or off. With protection on, Amazon GameLift won't shut down instances during a scale down event if they're hosting an active game session.

    2. Set a maximum Resource creation limit to limit the number of game sessions one player can create during a specified time span.

Step 5: Configure tags
  • (Optional) Add tags to the build by entering Key and Value pairs. Choose Next to continue to fleet creation review.

Step 6: Review and create.
  • Review your fleet configuration settings.

    You can update the fleet's metadata and configuration at any time, regardless of fleet status. For more information, see Manage your Amazon GameLift fleets. You can update fleet capacity after the fleet has reached ACTIVE status. For more information, see Scaling Amazon GameLift hosting capacity. You can also add or remove remote locations.

    When you're finished reviewing, choose Create.

    If your request is successful, the console displays the detail page for the new fleet resource. Initially the status is NEW, as Amazon GameLift starts the fleet creation process. You can track the new fleet's status on the Fleets page. A fleet is ready to host game sessions when it reaches status ACTIVE.

AWS CLI

To create a container fleet with the AWS CLI, open a command line window and use the create-fleet command. For more information about this command, see create-fleet in the AWS CLI Command Reference.

The example create-fleet request shown below creates a new container fleet with the following characteristics:

  • The ContainerGroupsConfiguration specifies a single replica container group definition: MegaFrogRaceServer.NA.v2. Three copies of the replica group will be deployed to each fleet instance. Each instance has 30 connection ports available for access to processes on the instance.

  • The fleet uses c5.large On-Demand instances.

  • It deploys container groups to the following locations:

    • us-west-2 (home Region)

    • ca-central-1 (remote location)

  • Each replica container group on an instance will run 5 game server processes concurrently, enabling each instance to host up to 15 game sessions at a time.

  • In each replica container group, Amazon GameLift allows two new game sessions to activate at the same time. It also terminates any activating game session if they aren't ready to host players within 300 seconds.

  • All game sessions hosted on instances in this fleet have game session protection turned on.

  • Individual players can create three new game sessions within a 15-minute period.

aws gamelift create-fleet \ --name SampleFleet123 \ --description "The sample test fleet" \ --compute-type "CONTAINER" \ --container-groups-configuration "ContainerGroupDefinitionNames=['MegaFrogRaceServer.NA.v2'], DesiredReplicaContainerGroupPerInstance=3, ConnectionPortRange={FromPort=1010,ToPort=1040}" \ --ec2-instance-type c5.large \ --region us-west-2 \ --locations "Location=ca-central-1" \ --fleet-type ON_DEMAND \ --runtime-configuration "GameSessionActivationTimeoutSeconds=300, MaxConcurrentGameSessionActivations=2, ServerProcesses=[{LaunchPath=/local/game/MegaFrogRace/server.exe,ConcurrentExecutions=5}]" \ --new-game-session-protection-policy "FullProtection" \ --resource-creation-limit-policy "NewGameSessionsPerCreator=3, PolicyPeriodInMinutes=15" \ --ec2-inbound-permissions "FromPort=1010,ToPort=1040,IpRange=0.0.0.0/0,Protocol=UDP" \

If the create-fleet request is successful, Amazon GameLift returns a set of fleet attributes that includes the configuration settings you requested and a new fleet ID. Amazon GameLift then sets the fleet status and the location statuses to New and initiates the fleet activation process. You can track the fleet's status and view other fleet information using these CLI commands:

You can change the fleet's capacity and other configuration settings as needed using these commands: