CreateFleet
This operation has been expanded to use with the Amazon GameLift containers feature, which is currently in public preview.
Creates a fleet of compute resources to host your game servers. Use this operation to set up the following types of fleets based on compute type:
Managed EC2 fleet
An EC2 fleet is a set of Amazon Elastic Compute Cloud (Amazon EC2) instances. Your game server build is
deployed to each fleet instance. Amazon GameLift manages the fleet's instances and controls the
lifecycle of game server processes, which host game sessions for players. EC2 fleets can
have instances in multiple locations. Each instance in the fleet is designated a
Compute
.
To create an EC2 fleet, provide these required parameters:
-
Either
BuildId
orScriptId
-
ComputeType
set toEC2
(the default value) -
EC2InboundPermissions
-
EC2InstanceType
-
FleetType
-
Name
-
RuntimeConfiguration
with at least oneServerProcesses
configuration
If successful, this operation creates a new fleet resource and places it in
NEW
status while Amazon GameLift initiates the fleet creation workflow. To debug your fleet, fetch logs, view performance
metrics or other actions on the fleet, create a development fleet with port 22/3389
open. As a best practice, we recommend opening ports for remote access only when you
need them and closing them when you're finished.
When the fleet status is ACTIVE, you can adjust capacity settings and turn autoscaling on/off for each location.
Managed container fleet
A container fleet is a set of Amazon Elastic Compute Cloud (Amazon EC2) instances. Your container architecture
is deployed to each fleet instance based on the fleet configuration. Amazon GameLift manages the
containers on each fleet instance and controls the lifecycle of game server processes,
which host game sessions for players. Container fleets can have instances in multiple
locations. Each container on an instance that runs game server processes is registered
as a Compute
.
To create a container fleet, provide these required parameters:
-
ComputeType
set toCONTAINER
-
ContainerGroupsConfiguration
-
EC2InboundPermissions
-
EC2InstanceType
-
FleetType
set toON_DEMAND
-
Name
-
RuntimeConfiguration
with at least oneServerProcesses
configuration
If successful, this operation creates a new fleet resource and places it in
NEW
status while Amazon GameLift initiates the fleet creation workflow.
When the fleet status is ACTIVE, you can adjust capacity settings and turn autoscaling on/off for each location.
Anywhere fleet
An Anywhere fleet represents compute resources that are not owned or managed by Amazon GameLift. You might create an Anywhere fleet with your local machine for testing, or use one to host game servers with on-premises hardware or other game hosting solutions.
To create an Anywhere fleet, provide these required parameters:
-
ComputeType
set toANYWHERE
-
Locations
specifying a custom location -
Name
If successful, this operation creates a new fleet resource and places it in
ACTIVE
status. You can register computes with a fleet in
ACTIVE
status.
Learn more
Request Syntax
{
"AnywhereConfiguration": {
"Cost": "string
"
},
"BuildId": "string
",
"CertificateConfiguration": {
"CertificateType": "string
"
},
"ComputeType": "string
",
"ContainerGroupsConfiguration": {
"ConnectionPortRange": {
"FromPort": number
,
"ToPort": number
},
"ContainerGroupDefinitionNames": [ "string
" ],
"DesiredReplicaContainerGroupsPerInstance": number
},
"Description": "string
",
"EC2InboundPermissions": [
{
"FromPort": number
,
"IpRange": "string
",
"Protocol": "string
",
"ToPort": number
}
],
"EC2InstanceType": "string
",
"FleetType": "string
",
"InstanceRoleArn": "string
",
"InstanceRoleCredentialsProvider": "string
",
"Locations": [
{
"Location": "string
"
}
],
"LogPaths": [ "string
" ],
"MetricGroups": [ "string
" ],
"Name": "string
",
"NewGameSessionProtectionPolicy": "string
",
"PeerVpcAwsAccountId": "string
",
"PeerVpcId": "string
",
"ResourceCreationLimitPolicy": {
"NewGameSessionsPerCreator": number
,
"PolicyPeriodInMinutes": number
},
"RuntimeConfiguration": {
"GameSessionActivationTimeoutSeconds": number
,
"MaxConcurrentGameSessionActivations": number
,
"ServerProcesses": [
{
"ConcurrentExecutions": number
,
"LaunchPath": "string
",
"Parameters": "string
"
}
]
},
"ScriptId": "string
",
"ServerLaunchParameters": "string
",
"ServerLaunchPath": "string
",
"Tags": [
{
"Key": "string
",
"Value": "string
"
}
]
}
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters.
The request accepts the following data in JSON format.
Note
In the following list, the required parameters are described first.
- Name
-
A descriptive label that is associated with a fleet. Fleet names do not need to be unique.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 1024.
Required: Yes
- AnywhereConfiguration
-
Amazon GameLift Anywhere configuration options.
Type: AnywhereConfiguration object
Required: No
- BuildId
-
The unique identifier for a custom game server build to be deployed to a fleet with compute type
EC2
. You can use either the build ID or ARN. The build must be uploaded to Amazon GameLift and inREADY
status. This fleet property can't be changed after the fleet is created.Type: String
Pattern:
^build-\S+|^arn:.*:build\/build-\S+
Required: No
- CertificateConfiguration
-
Prompts Amazon GameLift to generate a TLS/SSL certificate for the fleet. Amazon GameLift uses the certificates to encrypt traffic between game clients and the game servers running on Amazon GameLift. By default, the
CertificateConfiguration
isDISABLED
. You can't change this property after you create the fleet.AWS Certificate Manager (ACM) certificates expire after 13 months. Certificate expiration can cause fleets to fail, preventing players from connecting to instances in the fleet. We recommend you replace fleets before 13 months, consider using fleet aliases for a smooth transition.
Note
ACM isn't available in all AWS regions. A fleet creation request with certificate generation enabled in an unsupported Region, fails with a 4xx error. For more information about the supported Regions, see Supported Regions in the AWS Certificate Manager User Guide.
Type: CertificateConfiguration object
Required: No
- ComputeType
-
The type of compute resource used to host your game servers.
-
EC2
– The game server build is deployed to Amazon EC2 instances for cloud hosting. This is the default setting. -
CONTAINER
– Container images with your game server build and supporting software are deployed to Amazon EC2 instances for cloud hosting. With this compute type, you must specify theContainerGroupsConfiguration
parameter. -
ANYWHERE
– Game servers or container images with your game server and supporting software are deployed to compute resources that are provided and managed by you. With this compute type, you can also set theAnywhereConfiguration
parameter.
Type: String
Valid Values:
EC2 | ANYWHERE | CONTAINER
Required: No
-
- ContainerGroupsConfiguration
-
The container groups to deploy to instances in the container fleet and other fleet-level configuration settings. Use the CreateContainerGroupDefinition action to create container groups. A container fleet must have exactly one replica container group, and can optionally have one daemon container group. You can't change this property after you create the fleet.
Type: ContainerGroupsConfiguration object
Required: No
- Description
-
A description for the fleet.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 1024.
Required: No
- EC2InboundPermissions
-
The IP address ranges and port settings that allow inbound traffic to access game server processes and other processes on this fleet. Set this parameter for EC2 and container fleets. You can leave this parameter empty when creating the fleet, but you must call UpdateFleetPortSettings to set it before players can connect to game sessions. As a best practice, we recommend opening ports for remote access only when you need them and closing them when you're finished. For Realtime Servers fleets, Amazon GameLift automatically sets TCP and UDP ranges.
To manage inbound access for a container fleet, set this parameter to the same port numbers that you set for the fleet's connection port range. During the life of the fleet, update this parameter to control which connection ports are open to inbound traffic.
Type: Array of IpPermission objects
Array Members: Maximum number of 50 items.
Required: No
- EC2InstanceType
-
The Amazon GameLift-supported Amazon EC2 instance type to use with EC2 and container fleets. Instance type determines the computing resources that will be used to host your game servers, including CPU, memory, storage, and networking capacity. See Amazon Elastic Compute Cloud Instance Types
for detailed descriptions of Amazon EC2 instance types. Type: String
Valid Values:
t2.micro | t2.small | t2.medium | t2.large | c3.large | c3.xlarge | c3.2xlarge | c3.4xlarge | c3.8xlarge | c4.large | c4.xlarge | c4.2xlarge | c4.4xlarge | c4.8xlarge | c5.large | c5.xlarge | c5.2xlarge | c5.4xlarge | c5.9xlarge | c5.12xlarge | c5.18xlarge | c5.24xlarge | c5a.large | c5a.xlarge | c5a.2xlarge | c5a.4xlarge | c5a.8xlarge | c5a.12xlarge | c5a.16xlarge | c5a.24xlarge | r3.large | r3.xlarge | r3.2xlarge | r3.4xlarge | r3.8xlarge | r4.large | r4.xlarge | r4.2xlarge | r4.4xlarge | r4.8xlarge | r4.16xlarge | r5.large | r5.xlarge | r5.2xlarge | r5.4xlarge | r5.8xlarge | r5.12xlarge | r5.16xlarge | r5.24xlarge | r5a.large | r5a.xlarge | r5a.2xlarge | r5a.4xlarge | r5a.8xlarge | r5a.12xlarge | r5a.16xlarge | r5a.24xlarge | m3.medium | m3.large | m3.xlarge | m3.2xlarge | m4.large | m4.xlarge | m4.2xlarge | m4.4xlarge | m4.10xlarge | m5.large | m5.xlarge | m5.2xlarge | m5.4xlarge | m5.8xlarge | m5.12xlarge | m5.16xlarge | m5.24xlarge | m5a.large | m5a.xlarge | m5a.2xlarge | m5a.4xlarge | m5a.8xlarge | m5a.12xlarge | m5a.16xlarge | m5a.24xlarge | c5d.large | c5d.xlarge | c5d.2xlarge | c5d.4xlarge | c5d.9xlarge | c5d.12xlarge | c5d.18xlarge | c5d.24xlarge | c6a.large | c6a.xlarge | c6a.2xlarge | c6a.4xlarge | c6a.8xlarge | c6a.12xlarge | c6a.16xlarge | c6a.24xlarge | c6i.large | c6i.xlarge | c6i.2xlarge | c6i.4xlarge | c6i.8xlarge | c6i.12xlarge | c6i.16xlarge | c6i.24xlarge | r5d.large | r5d.xlarge | r5d.2xlarge | r5d.4xlarge | r5d.8xlarge | r5d.12xlarge | r5d.16xlarge | r5d.24xlarge | m6g.medium | m6g.large | m6g.xlarge | m6g.2xlarge | m6g.4xlarge | m6g.8xlarge | m6g.12xlarge | m6g.16xlarge | c6g.medium | c6g.large | c6g.xlarge | c6g.2xlarge | c6g.4xlarge | c6g.8xlarge | c6g.12xlarge | c6g.16xlarge | r6g.medium | r6g.large | r6g.xlarge | r6g.2xlarge | r6g.4xlarge | r6g.8xlarge | r6g.12xlarge | r6g.16xlarge | c6gn.medium | c6gn.large | c6gn.xlarge | c6gn.2xlarge | c6gn.4xlarge | c6gn.8xlarge | c6gn.12xlarge | c6gn.16xlarge | c7g.medium | c7g.large | c7g.xlarge | c7g.2xlarge | c7g.4xlarge | c7g.8xlarge | c7g.12xlarge | c7g.16xlarge | r7g.medium | r7g.large | r7g.xlarge | r7g.2xlarge | r7g.4xlarge | r7g.8xlarge | r7g.12xlarge | r7g.16xlarge | m7g.medium | m7g.large | m7g.xlarge | m7g.2xlarge | m7g.4xlarge | m7g.8xlarge | m7g.12xlarge | m7g.16xlarge | g5g.xlarge | g5g.2xlarge | g5g.4xlarge | g5g.8xlarge | g5g.16xlarge
Required: No
- FleetType
-
Indicates whether to use On-Demand or Spot instances for this fleet. By default, this property is set to
ON_DEMAND
. Learn more about when to use On-Demand versus Spot Instances. This fleet property can't be changed after the fleet is created.Type: String
Valid Values:
ON_DEMAND | SPOT
Required: No
- InstanceRoleArn
-
A unique identifier for an IAM role with access permissions to other AWS services. Any application that runs on an instance in the fleet--including install scripts, server processes, and other processes--can use these permissions to interact with AWS resources that you own or have access to. For more information about using the role with your game server builds, see Communicate with other AWS resources from your fleets. This fleet property can't be changed after the fleet is created.
Type: String
Length Constraints: Minimum length of 1.
Required: No
- InstanceRoleCredentialsProvider
-
Prompts Amazon GameLift to generate a shared credentials file for the IAM role that's defined in
InstanceRoleArn
. The shared credentials file is stored on each fleet instance and refreshed as needed. Use shared credentials for applications that are deployed along with the game server executable, if the game server is integrated with server SDK version 5.x. For more information about using shared credentials, see Communicate with other AWS resources from your fleets.Type: String
Valid Values:
SHARED_CREDENTIAL_FILE
Required: No
- Locations
-
A set of remote locations to deploy additional instances to and manage as a multi-location fleet. Use this parameter when creating a fleet in AWS Regions that support multiple locations. You can add any AWS Region or Local Zone that's supported by Amazon GameLift. Provide a list of one or more AWS Region codes, such as
us-west-2
, or Local Zone names. When using this parameter, Amazon GameLift requires you to include your home location in the request. For a list of supported Regions and Local Zones, see Amazon GameLift service locations for managed hosting.Type: Array of LocationConfiguration objects
Array Members: Minimum number of 1 item. Maximum number of 100 items.
Required: No
- LogPaths
-
This parameter is no longer used. To specify where Amazon GameLift should store log files once a server process shuts down, use the Amazon GameLift server API
ProcessReady()
and specify one or more directory paths inlogParameters
. For more information, see Initialize the server process in the Amazon GameLift Developer Guide.Type: Array of strings
Length Constraints: Minimum length of 1. Maximum length of 1024.
Required: No
- MetricGroups
-
The name of an AWS CloudWatch metric group to add this fleet to. A metric group is used to aggregate the metrics for multiple fleets. You can specify an existing metric group name or set a new name to create a new metric group. A fleet can be included in only one metric group at a time.
Type: Array of strings
Array Members: Maximum number of 1 item.
Length Constraints: Minimum length of 1. Maximum length of 255.
Required: No
- NewGameSessionProtectionPolicy
-
The status of termination protection for active game sessions on the fleet. By default, this property is set to
NoProtection
. You can also set game session protection for an individual game session by calling UpdateGameSession.-
NoProtection - Game sessions can be terminated during active gameplay as a result of a scale-down event.
-
FullProtection - Game sessions in
ACTIVE
status cannot be terminated during a scale-down event.
Type: String
Valid Values:
NoProtection | FullProtection
Required: No
-
- PeerVpcAwsAccountId
-
Used when peering your Amazon GameLift fleet with a VPC, the unique identifier for the AWS account that owns the VPC. You can find your account ID in the AWS Management Console under account settings.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 1024.
Required: No
- PeerVpcId
-
A unique identifier for a VPC with resources to be accessed by your Amazon GameLift fleet. The VPC must be in the same Region as your fleet. To look up a VPC ID, use the VPC Dashboard
in the AWS Management Console. Learn more about VPC peering in VPC Peering with Amazon GameLift Fleets. Type: String
Length Constraints: Minimum length of 1. Maximum length of 1024.
Required: No
- ResourceCreationLimitPolicy
-
A policy that limits the number of game sessions that an individual player can create on instances in this fleet within a specified span of time.
Type: ResourceCreationLimitPolicy object
Required: No
- RuntimeConfiguration
-
Instructions for how to launch and run server processes on the fleet. Set runtime configuration for EC2 fleets and container fleets. For an Anywhere fleets, set this parameter only if the fleet is running the Amazon GameLift Agent. The runtime configuration defines one or more server process configurations. Each server process identifies a game executable or Realtime script file and the number of processes to run concurrently.
Note
This parameter replaces the parameters
ServerLaunchPath
andServerLaunchParameters
, which are still supported for backward compatibility.Type: RuntimeConfiguration object
Required: No
- ScriptId
-
The unique identifier for a Realtime configuration script to be deployed to a fleet with compute type
EC2
. You can use either the script ID or ARN. Scripts must be uploaded to Amazon GameLift prior to creating the fleet. This fleet property can't be changed after the fleet is created.Type: String
Pattern:
^script-\S+|^arn:.*:script\/script-\S+
Required: No
- ServerLaunchParameters
-
This parameter is no longer used. Specify server launch parameters using the
RuntimeConfiguration
parameter. Requests that use this parameter instead continue to be valid.Type: String
Length Constraints: Minimum length of 1. Maximum length of 1024.
Pattern:
[A-Za-z0-9_:.+\/\\\- =@;{},?'\[\]"]+
Required: No
- ServerLaunchPath
-
This parameter is no longer used. Specify a server launch path using the
RuntimeConfiguration
parameter. Requests that use this parameter instead continue to be valid.Type: String
Length Constraints: Minimum length of 1. Maximum length of 1024.
Pattern:
[A-Za-z0-9_:.+\/\\\- ]+
Required: No
- Tags
-
A list of labels to assign to the new fleet resource. Tags are developer-defined key-value pairs. Tagging AWS resources are useful for resource management, access management and cost allocation. For more information, see Tagging AWS Resources in the AWS General Reference.
Type: Array of Tag objects
Array Members: Minimum number of 0 items. Maximum number of 200 items.
Required: No
Response Syntax
{
"FleetAttributes": {
"AnywhereConfiguration": {
"Cost": "string"
},
"BuildArn": "string",
"BuildId": "string",
"CertificateConfiguration": {
"CertificateType": "string"
},
"ComputeType": "string",
"ContainerGroupsAttributes": {
"ConnectionPortRange": {
"FromPort": number,
"ToPort": number
},
"ContainerGroupDefinitionProperties": [
{
"ContainerGroupDefinitionName": "string",
"SchedulingStrategy": "string"
}
],
"ContainerGroupsPerInstance": {
"DesiredReplicaContainerGroupsPerInstance": number,
"MaxReplicaContainerGroupsPerInstance": number
}
},
"CreationTime": number,
"Description": "string",
"FleetArn": "string",
"FleetId": "string",
"FleetType": "string",
"InstanceRoleArn": "string",
"InstanceRoleCredentialsProvider": "string",
"InstanceType": "string",
"LogPaths": [ "string" ],
"MetricGroups": [ "string" ],
"Name": "string",
"NewGameSessionProtectionPolicy": "string",
"OperatingSystem": "string",
"ResourceCreationLimitPolicy": {
"NewGameSessionsPerCreator": number,
"PolicyPeriodInMinutes": number
},
"ScriptArn": "string",
"ScriptId": "string",
"ServerLaunchParameters": "string",
"ServerLaunchPath": "string",
"Status": "string",
"StoppedActions": [ "string" ],
"TerminationTime": number
},
"LocationStates": [
{
"Location": "string",
"Status": "string"
}
]
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- FleetAttributes
-
The properties for the new fleet, including the current status. All fleets are placed in
NEW
status on creation.Type: FleetAttributes object
- LocationStates
-
The fleet's locations and life-cycle status of each location. For new fleets, the status of all locations is set to
NEW
. During fleet creation, Amazon GameLift updates each location status as instances are deployed there and prepared for game hosting. This list includes an entry for the fleet's home Region. For fleets with no remote locations, only one entry, representing the home Region, is returned.Type: Array of LocationState objects
Errors
For information about the errors that are common to all actions, see Common Errors.
- ConflictException
-
The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request.
HTTP Status Code: 400
- InternalServiceException
-
The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.
HTTP Status Code: 500
- InvalidRequestException
-
One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.
HTTP Status Code: 400
- LimitExceededException
-
The requested operation would cause the resource to exceed the allowed service limit. Resolve the issue before retrying.
HTTP Status Code: 400
- NotFoundException
-
The requested resources was not found. The resource was either not created yet or deleted.
HTTP Status Code: 400
- NotReadyException
-
The operation failed because Amazon GameLift has not yet finished validating this compute. We recommend attempting 8 to 10 retries over 3 to 5 minutes with exponential backoffs and jitter
. HTTP Status Code: 400
- TaggingFailedException
-
The requested tagging operation did not succeed. This may be due to invalid tag format or the maximum tag limit may have been exceeded. Resolve the issue before retrying.
HTTP Status Code: 400
- UnauthorizedException
-
The client failed authentication. Clients should not retry such requests.
HTTP Status Code: 400
- UnsupportedRegionException
-
The requested operation is not supported in the Region specified.
HTTP Status Code: 400
Examples
Create fleet with minimal configuration
This example creates an EC2 fleet for a game server build with a minimal
configuration and a placeholder launch path. You can use this fleet to create
queues and matchmakers, test Amazon GameLift Server API calls, etc. When you're ready to
start hosting game sessions, complete the configuration settings using the
UpdateFleet
operations. If the fleet is in a Region that
supports multiple locations, you can add remote locations with
CreateFleetLocations
later. Note: this example generates a TLS
certificate for the fleet, which can only be enabled during fleet
creation.
HTTP requests are authenticated using an AWS Signature Version 4 signature in the Authorization
header field.
Sample Request
{
"Name": "My_Fleet_1",
"Description": "A minimal sample fleet",
"BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff",
"CertificateConfiguration": {
"CertificateType": "GENERATED"
},
"ComputeType": "EC2",
"EC2InstanceType": "c4.large",
"FleetType": "ON_DEMAND",
"RuntimeConfiguration": {
"ServerProcesses": [
{"LaunchPath": "/local/game/mygame.exe",
"ConcurrentExecutions": 1}
]
}
}
Sample Response
{
"FleetAttributes": {
"BuildArn": "arn:aws:gamelift:us-west-2::build/build-1111aaaa-22bb-33cc-44dd-5555eeee66ff",
"BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff",
"CertificateConfiguration": {
"CertificateType": "GENERATED"
},
"ComputeType": "EC2",
"CreationTime": 1496365885.44,
"Description": "A minimal sample fleet",
"FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa",
"FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa",
"FleetType": "ON_DEMAND",
"InstanceType": "c4.large",
"MetricGroups": [
"default"
],
"Name": "My_Fleet_1",
"NewGameSessionProtectionPolicy": "NoProtection",
"OperatingSystem": "AMAZON_LINUX_2023",
"OperatingSystem": "AMAZON_LINUX_2",
"Status": "NEW"
}
}
Create fleet with minimal configuration (Windows)
This example creates a fleet for a game server build with a minimal
configuration and a placeholder launch path. You can use this fleet to create
queues and matchmakers, test Amazon GameLift Server API calls, etc. Once you're ready to
start hosting game sessions, complete the configuration settings with the
UpdateFleet
operations. If the fleet is created in a Region
that supports multiple locations, you can add remote locations with
CreateFleetLocations
later.
HTTP requests are authenticated using an AWS Signature Version 4 signature in the Authorization
header field.
Sample Request
{
"Name": "My_Fleet_1",
"Description": "A minimal sample fleet",
"BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff",
"ComputeType": "EC2",
"EC2InstanceType": "c4.large",
"FleetType": "ON_DEMAND",
"RuntimeConfiguration": {
"ServerProcesses": [
{"LaunchPath": "c:\\game\\mygame.exe",
"ConcurrentExecutions": 1}
]
}
}
Sample Response
{
"FleetAttributes": {
"BuildArn": "arn:aws:gamelift:us-west-2::build/build-1111aaaa-22bb-33cc-44dd-5555eeee66ff",
"BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff",
"CertificateConfiguration": {
"CertificateType": "DISABLED"
},
"ComputeType": "EC2",
"CreationTime": 1496365885.44,
"Description": "A minimal sample fleet",
"FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa",
"FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa",
"FleetType": "ON_DEMAND",
"InstanceType": "c4.large",
"MetricGroups": [
"default"
],
"Name": "My_Fleet_1",
"NewGameSessionProtectionPolicy": "NoProtection",
"OperatingSystem": "WINDOWS_2016",
"Status": "ACTIVE"
}
}
Create fleet with full configuration
This example creates an EC2 fleet with complete configuration details. The new
fleet, which is created in the AWS Region us-west-2
, also deploys
instances to two remote locations. In this example, the runtime configuration
defines two server process configurations. The first configuration calls for
three concurrent processes of the game server to run in standard mode. The
second configuration calls for one process of the game server to run in a test
mode. As a result, all fleet instances will maintain a total of four processes
concurrently. This example also references an instance role ARN, which allows
the processes running on each instance to access other AWS resources. The
example opens port 22 for debugging the fleet. The game server build in this
example runs on Windows.
HTTP requests are authenticated using an AWS Signature Version 4 signature in the Authorization
header field.
Sample Request
{
"Name": "My_Fleet_1",
"Description": "A fully configured sample fleet with",
"BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff",
"CertificateConfiguration": {
"CertificateType": "GENERATED"
},
"ComputeType": "EC2",
"EC2InstanceType": "c5.large",
"EC2InboundPermissions": [
{"FromPort": 33435,
"ToPort": 33435,
"IpRange": "10.24.34.0/23",
"Protocol": "UDP"},
{"FromPort": 22,
"ToPort": 22,
"IpRange": "10.24.34.0/23",
"Protocol": "TCP"}
],
"FleetType": "ON_DEMAND",
"Locations": [
{"Location": "us-east-2"},
{"Location": "ca-central-1"}
],
"NewGameSessionProtectionPolicy": "FullProtection",
"RuntimeConfiguration": {
"ServerProcesses": [
{"LaunchPath": "c:\\game\\mygame.exe",
"Parameters": "+map Winter444",
"ConcurrentExecutions": 3},
{"LaunchPath": "c:\\game\\mygame.exe",
"Parameters": "-dev -console +map Winter444",
"ConcurrentExecutions": 1}
],
"MaxConcurrentGameSessionActivations": 2,
"GameSessionActivationTimeoutSeconds": 300
},
"ResourceCreationLimitPolicy": {
"NewGameSessionsPerCreator": 3,
"PolicyPeriodInMinutes": 15
},
"MetricGroups": ["EMEAfleets"],
"InstanceRoleArn": "arn:aws:iam::444455556666:role/S3AccessForGameLift",
}
Sample Response
{
"FleetAttributes": {
"BuildArn": "arn:aws:gamelift:us-west-2::build/build-1111aaaa-22bb-33cc-44dd-5555eeee66ff",
"BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff",
"CertificateConfiguration": {
"CertificateType": "GENERATED"
},
"ComputeType": "EC2",
"CreationTime": 1496375088.502,
"Description": "A fully configured sample fleet",
"FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa",
"FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa",
"FleetType": "ON_DEMAND",
"InstanceRoleArn": "arn:aws:iam::444455556666:role/S3AccessForGameLift",
"MetricGroups": [
"EMEAfleets"
],
"Name": "My_Fleet_One",
"NewGameSessionProtectionPolicy": "FullProtection",
"OperatingSystem": "WINDOWS_2016",
"ResourceCreationLimitPolicy": {
"NewGameSessionsPerCreator": 3,
"PolicyPeriodInMinutes": 15
}
},
"LocationStates": [
{
"Location": "us-east-2",
"Status": "NEW"
},
{
"Location": "ca-central-1",
"Status": "NEW"
}
]
"Status": "NEW",
}
Create a container fleet
This example creates a container fleet with a replica container group only.
The new fleet deploys instances in the home AWS Region
(us-west-2
) and in two remote locations (us-east-2
and
ca-central-1
). In this example, the container fleet deploys 3
copies of the replica container group per fleet instance. Our runtime
configuration instructs the Amazon GameLift Agent to run 5 concurrent server processes
in each container group. This means that our new fleet needs at least 15 (3*5)
connection ports and preferably double that number. The EC2InboundPermissions
property opens all the fleet's connection ports to external traffic.
HTTP requests are authenticated using an AWS Signature Version 4 signature in the Authorization
header field.
Sample Request
{
"Name": "My_Container_Fleet_1",
"Description": "A fully configured container fleet",
"CertificateConfiguration": {
"CertificateType": "GENERATED"
},
"ComputeType": "CONTAINER",
"ContainerGroupsConfiguration": {
"ConnectionPortRange": {
"FromPort": 1010,
"ToPort": 1040
},
"ContainerGroupDefinitionNames": [ "MegaFrogRaceServer.NA.v2" ],
"DesiredReplicaContainerGroupsPerInstance": 3
},
"EC2InstanceType": "c5.large",
"EC2InboundPermissions": [
{"FromPort": 1010,
"ToPort": 1040,
"IpRange": "10.24.34.0/23",
"Protocol": "TCP"}
}
],
"FleetType": "ON_DEMAND",
"NewGameSessionProtectionPolicy": "FullProtection",
"RuntimeConfiguration": {
"ServerProcesses": [
{"LaunchPath": "c:\\game\\mygame.exe",
"Parameters": "+map Winter444",
"ConcurrentExecutions": 5}
],
"MaxConcurrentGameSessionActivations": 2,
"GameSessionActivationTimeoutSeconds": 300
},
"ResourceCreationLimitPolicy": {
"NewGameSessionsPerCreator": 3,
"PolicyPeriodInMinutes": 15
},
"MetricGroups": ["EMEAfleets"],
"InstanceRoleArn": "arn:aws:iam::444455556666:role/S3AccessForGameLift",
}
Sample Response
{
"FleetAttributes": {
"CertificateConfiguration": {
"CertificateType": "GENERATED"
},
"ComputeType": "EC2",
"ContainerGroupsAttributes": {
"ConnectionPortRange": {
"FromPort": 1010,
"ToPort": 1040
},
"ContainerGroupDefinitionProperties": [
{
"ContainerGroupDefinitionName": MegaFrogRaceServer.NA.v2",
"SchedulingStrategy": "REPLICA"
}
],
"ContainerGroupsPerInstance": {
"DesiredReplicaContainerGroupsPerInstance": 5,
"MaxReplicaContainerGroupsPerInstance": 6
}
},
"CreationTime": 1496375088.502,
"Description": "A fully configured sample fleet",
"FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa",
"FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa",
"FleetType": "ON_DEMAND",
"InstanceRoleArn": "arn:aws:iam::444455556666:role/S3AccessForGameLift",
"MetricGroups": [
"EMEAfleets"
],
"Name": "My_Container_Fleet_1",
"NewGameSessionProtectionPolicy": "FullProtection",
"OperatingSystem": "AMAZON_LINUX_2023",
"OperatingSystem": "AMAZON_LINUX_2",
"ResourceCreationLimitPolicy": {
"NewGameSessionsPerCreator": 3,
"PolicyPeriodInMinutes": 15
}
},
"LocationStates": [
{
"Location": "us-east-2",
"Status": "NEW"
},
{
"Location": "ca-central-1",
"Status": "NEW"
}
]
"Status": "NEW",
}
Create a Realtime Servers fleet
This example creates a fleet using a Realtime script that has been uploaded to
Amazon GameLift. All Realtime servers are deployed onto Linux machines. This example
represents a simple yet complete fleet configuration. You can change
configuration settings with the UpdateRuntimeConfiguration operation. The new fleet, which is
created in the AWS Region us-west-2
, also deploys instances to
two remote locations.
In this example, the uploaded Realtime script includes multiple script files,
with the Init()
function located in the script file called
"myMainScript.js". This file is identified as the launch script in the runtime
configuration.
Note
We recommend using a minimal version of the Realtime script when creating your fleets (see this working code example). This will make it much easier to troubleshoot fleet creation issues. After the fleet has reached ACTIVE status, you can update your Realtime script as needed.
Sample Request
{
"Name": "My_Realtime_Fleet_1",
"Description": "A complete Realtime sample fleet",
"CertificateConfiguration": {
"CertificateType": "GENERATED"
},
"EC2InstanceType": "c4.large",
"FleetType": "SPOT",
"ComputeType": "EC2",
"Locations": [
{"Location": "us-east-2"},
{"Location": "ca-central-1"}
],
"RuntimeConfiguration": {
"ServerProcesses": [
{"LaunchPath": "/local/game/myMainScript.js",
"Parameters": "+map Winter444",
"ConcurrentExecutions": 5}
]
},
"ScriptId": "script-1111aaaa-22bb-33cc-44dd-5555eeee66ff"
}
Sample Response
{
"FleetAttributes": {
"CertificateConfiguration": {
"CertificateType": "GENERATED"
},
"ComputeType": "EC2",
"CreationTime": 1496375088.502,
"Description": "A complete Realtime sample fleet",
"FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa",
"FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa",
"FleetType": "SPOT",
"MetricGroups": [
"default"
],
"Name": "My_Realtime_Fleet_1",
"NewGameSessionProtectionPolicy": "NoProtection",
"OperatingSystem": "AMAZON_LINUX_2023",
"OperatingSystem": "AMAZON_LINUX_2",
"ScriptArn": "arn:aws:gamelift:us-west-2::script/script-1111aaaa-22bb-33cc-44dd-5555eeee66ff",
"ScriptId": "script-1111aaaa-22bb-33cc-44dd-5555eeee66ff",
"Status": "NEW"
},
"LocationStates": [
{
"Location": "us-east-2",
"Status": "NEW"
},
{
"Location": "ca-central-1",
"Status": "NEW"
}
]
}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: