GameLift.Client.
create_fleet
(**kwargs)¶Creates a fleet of Amazon Elastic Compute Cloud (Amazon Elastic Compute Cloud) instances to host your custom game server or Realtime Servers. Use this operation to configure the computing resources for your fleet and provide instructions for running game servers on each instance.
Most GameLift fleets can deploy instances to multiple locations, including the home Region (where the fleet is created) and an optional set of remote locations. Fleets that are created in the following Amazon Web Services Regions support multiple locations: us-east-1 (N. Virginia), us-west-2 (Oregon), eu-central-1 (Frankfurt), eu-west-1 (Ireland), ap-southeast-2 (Sydney), ap-northeast-1 (Tokyo), and ap-northeast-2 (Seoul). Fleets that are created in other GameLift Regions can deploy instances in the fleet's home Region only. All fleet instances use the same configuration regardless of location; however, you can adjust capacity settings and turn auto-scaling on/off for each location.
To create a fleet, choose the hardware for your instances, specify a game server build or Realtime script to deploy, and provide a runtime configuration to direct GameLift how to start and run game servers on each instance in the fleet. Set permissions for inbound traffic to your game servers, and enable optional features as needed. When creating a multi-location fleet, provide a list of additional remote locations.
If you need to debug your fleet, fetch logs, view performance metrics or other actions on the fleet, create the 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.
If successful, this operation creates a new Fleet resource and places it in NEW
status, which prompts GameLift to initiate the fleet creation workflow.
See also: AWS API Documentation
Request Syntax
response = client.create_fleet(
Name='string',
Description='string',
BuildId='string',
ScriptId='string',
ServerLaunchPath='string',
ServerLaunchParameters='string',
LogPaths=[
'string',
],
EC2InstanceType='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',
EC2InboundPermissions=[
{
'FromPort': 123,
'ToPort': 123,
'IpRange': 'string',
'Protocol': 'TCP'|'UDP'
},
],
NewGameSessionProtectionPolicy='NoProtection'|'FullProtection',
RuntimeConfiguration={
'ServerProcesses': [
{
'LaunchPath': 'string',
'Parameters': 'string',
'ConcurrentExecutions': 123
},
],
'MaxConcurrentGameSessionActivations': 123,
'GameSessionActivationTimeoutSeconds': 123
},
ResourceCreationLimitPolicy={
'NewGameSessionsPerCreator': 123,
'PolicyPeriodInMinutes': 123
},
MetricGroups=[
'string',
],
PeerVpcAwsAccountId='string',
PeerVpcId='string',
FleetType='ON_DEMAND'|'SPOT',
InstanceRoleArn='string',
CertificateConfiguration={
'CertificateType': 'DISABLED'|'GENERATED'
},
Locations=[
{
'Location': 'string'
},
],
Tags=[
{
'Key': 'string',
'Value': 'string'
},
],
ComputeType='EC2'|'ANYWHERE',
AnywhereConfiguration={
'Cost': 'string'
}
)
[REQUIRED]
A descriptive label that is associated with a fleet. Fleet names do not need to be unique.
READY
status. This fleet property cannot be changed later.RuntimeConfiguration
parameter. Requests that use this parameter instead continue to be valid.RuntimeConfiguration
parameter. Requests that use this parameter instead continue to be valid.This parameter is no longer used. To specify where GameLift should store log files once a server process shuts down, use the GameLift server APIProcessReady()
and specify one or more directory paths inlogParameters
. For more information, see Initialize the server process in the GameLift Developer Guide .
The allowed IP address ranges and port settings that allow inbound traffic to access game sessions on this fleet. If the fleet is hosting a custom game build, this property must be set before players can connect to game sessions. For Realtime Servers fleets, GameLift automatically sets TCP and UDP ranges.
A range of IP addresses and port settings that allow inbound traffic to connect to server processes on an instance in a fleet. New game sessions are assigned an IP address/port number combination, which must fall into the fleet's allowed ranges. Fleets with custom game builds must have permissions explicitly set. For Realtime Servers fleets, GameLift automatically opens two port ranges, one for TCP messaging and one for UDP.
A starting value for a range of allowed port numbers.
For fleets using Windows and Linux builds, only ports 1026-60000 are valid.
An ending value for a range of allowed port numbers. Port numbers are end-inclusive. This value must be higher than FromPort
.
For fleets using Windows and Linux builds, only ports 1026-60000 are valid.
A range of allowed IP addresses. This value must be expressed in CIDR notation. Example: " 000.000.000.000/[subnet mask]
" or optionally the shortened version " 0.0.0.0/[subnet mask]
".
The network communication protocol used by the fleet.
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.
ACTIVE
status cannot be terminated during a scale-down event.Instructions for how to launch and maintain server processes on instances in the fleet. The runtime configuration defines one or more server process configurations, each identifying a build executable or Realtime script file and the number of processes of that type to run concurrently.
Note
The RuntimeConfiguration
parameter is required unless the fleet is being configured using the older parameters ServerLaunchPath
and ServerLaunchParameters
, which are still supported for backward compatibility.
A collection of server process configurations that identify what server processes to run on each instance in a fleet.
A set of instructions for launching server processes on each instance in a fleet. Server processes run either an executable in a custom game build or a Realtime Servers script. Server process configurations are part of a fleet's runtime configuration.
The location of a game build executable or the Realtime script file that contains the Init()
function. Game builds and Realtime scripts are installed on instances at the root:
C:\game
. Example: " C:\game\MyGame\server.exe
"/local/game
. Examples: " /local/game/MyGame/server.exe
" or " /local/game/MyRealtimeScript.js
"An optional list of parameters to pass to the server executable or Realtime script on launch.
The number of server processes using this configuration that run concurrently on each instance.
The number of game sessions in status ACTIVATING
to allow on an instance. This setting limits the instance resources that can be used for new game activations at any one time.
The maximum amount of time (in seconds) allowed to launch a new game session and have it report ready to host players. During this time, the game session is in status ACTIVATING
. If the game session does not become active before the timeout, it is ended and the game session status is changed to TERMINATED
.
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.
A policy that puts limits on the number of game sessions that a player can create within a specified span of time. With this policy, you can control players' ability to consume available resources.
The policy is evaluated when a player tries to create a new game session. On receiving a CreateGameSession
request, GameLift checks that the player (identified by CreatorId
) has created fewer than game session limit in the specified time period.
The time span used in evaluating the resource creation limit policy.
The name of an Amazon Web Services 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.
ON_DEMAND
. Learn more about when to use On-Demand versus Spot Instances. This property cannot be changed after the fleet is created.Prompts GameLift to generate a TLS/SSL certificate for the fleet. GameLift uses the certificates to encrypt traffic between game clients and the game servers running on GameLift. By default, the CertificateConfiguration
is DISABLED
. You can't change this property after you create the fleet.
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 Amazon Web Services 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 Certificate Manager User Guide .
Indicates whether a TLS/SSL certificate is generated for a fleet.
Valid values include:
A set of remote locations to deploy additional instances to and manage as part of the fleet. This parameter can only be used when creating fleets in Amazon Web Services Regions that support multiple locations. You can add any GameLift-supported Amazon Web Services Region as a remote location, in the form of an Amazon Web Services Region code such as us-west-2
. To create a fleet with instances in the home Region only, omit this parameter.
A remote location where a multi-location fleet can deploy EC2 instances for game hosting.
An Amazon Web Services Region code, such as us-west-2
.
A list of labels to assign to the new fleet resource. Tags are developer-defined key-value pairs. Tagging Amazon Web Services resources are useful for resource management, access management and cost allocation. For more information, see Tagging Amazon Web Services Resources in the Amazon Web Services General Reference .
A label that can be assigned to a GameLift resource.
Learn moreTagging Amazon Web Services Resources in the Amazon Web Services General Reference
Amazon Web Services Tagging Strategies
Related actions
The key for a developer-defined key:value pair for tagging an Amazon Web Services resource.
The value for a developer-defined key:value pair for tagging an Amazon Web Services resource.
GameLift Anywhere configuration options.
The cost to run your fleet per hour. GameLift uses the provided cost of your fleet to balance usage in queues. For more information about queues, see Setting up queues.
dict
Response Syntax
{
'FleetAttributes': {
'FleetId': 'string',
'FleetArn': 'string',
'FleetType': 'ON_DEMAND'|'SPOT',
'InstanceType': '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',
'Description': 'string',
'Name': 'string',
'CreationTime': datetime(2015, 1, 1),
'TerminationTime': datetime(2015, 1, 1),
'Status': 'NEW'|'DOWNLOADING'|'VALIDATING'|'BUILDING'|'ACTIVATING'|'ACTIVE'|'DELETING'|'ERROR'|'TERMINATED'|'NOT_FOUND',
'BuildId': 'string',
'BuildArn': 'string',
'ScriptId': 'string',
'ScriptArn': 'string',
'ServerLaunchPath': 'string',
'ServerLaunchParameters': 'string',
'LogPaths': [
'string',
],
'NewGameSessionProtectionPolicy': 'NoProtection'|'FullProtection',
'OperatingSystem': 'WINDOWS_2012'|'AMAZON_LINUX'|'AMAZON_LINUX_2',
'ResourceCreationLimitPolicy': {
'NewGameSessionsPerCreator': 123,
'PolicyPeriodInMinutes': 123
},
'MetricGroups': [
'string',
],
'StoppedActions': [
'AUTO_SCALING',
],
'InstanceRoleArn': 'string',
'CertificateConfiguration': {
'CertificateType': 'DISABLED'|'GENERATED'
},
'ComputeType': 'EC2'|'ANYWHERE',
'AnywhereConfiguration': {
'Cost': 'string'
}
},
'LocationStates': [
{
'Location': 'string',
'Status': 'NEW'|'DOWNLOADING'|'VALIDATING'|'BUILDING'|'ACTIVATING'|'ACTIVE'|'DELETING'|'ERROR'|'TERMINATED'|'NOT_FOUND'
},
]
}
Response Structure
(dict) --
FleetAttributes (dict) --
The properties for the new fleet, including the current status. All fleets are placed in NEW
status on creation.
FleetId (string) --
A unique identifier for the fleet.
FleetArn (string) --
The Amazon Resource Name ( ARN ) that is assigned to a GameLift fleet resource and uniquely identifies it. ARNs are unique across all Regions. Format is arn:aws:gamelift:<region>::fleet/fleet-a1234567-b8c9-0d1e-2fa3-b45c6d7e8912
. In a GameLift fleet ARN, the resource ID matches the FleetId
value.
FleetType (string) --
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 property cannot be changed after the fleet is created.
InstanceType (string) --
The Amazon EC2 instance type that determines the computing resources of each instance in the fleet. Instance type defines the CPU, memory, storage, and networking capacity. See Amazon Elastic Compute Cloud Instance Types for detailed descriptions.
Description (string) --
A human-readable description of the fleet.
Name (string) --
A descriptive label that is associated with a fleet. Fleet names do not need to be unique.
CreationTime (datetime) --
A time stamp indicating when this data object was created. Format is a number expressed in Unix time as milliseconds (for example "1469498468.057"
).
TerminationTime (datetime) --
A time stamp indicating when this data object was terminated. Format is a number expressed in Unix time as milliseconds (for example "1469498468.057"
).
Status (string) --
Current status of the fleet. Possible fleet statuses include the following:
BuildId (string) --
A unique identifier for the build resource that is deployed on instances in this fleet.
BuildArn (string) --
The Amazon Resource Name ( ARN ) associated with the GameLift build resource that is deployed on instances in this fleet. In a GameLift build ARN, the resource ID matches the BuildId
value.
ScriptId (string) --
A unique identifier for the Realtime script resource that is deployed on instances in this fleet.
ScriptArn (string) --
The Amazon Resource Name ( ARN ) associated with the GameLift script resource that is deployed on instances in this fleet. In a GameLift script ARN, the resource ID matches the ScriptId
value.
ServerLaunchPath (string) --
This parameter is no longer used. Server launch paths are now defined using the fleet's RuntimeConfiguration . Requests that use this parameter instead continue to be valid.
ServerLaunchParameters (string) --
This parameter is no longer used. Server launch parameters are now defined using the fleet's runtime configuration . Requests that use this parameter instead continue to be valid.
LogPaths (list) --
This parameter is no longer used. Game session log paths are now defined using the GameLift server API
ProcessReady()
logParameters
. See more information in the Server API Reference.
NewGameSessionProtectionPolicy (string) --
The type of game session protection to set on all new instances that are started in the fleet.
ACTIVE
status, it cannot be terminated during a scale-down event.OperatingSystem (string) --
The operating system of the fleet's computing resources. A fleet's operating system is determined by the OS of the build or script that is deployed on this fleet.
ResourceCreationLimitPolicy (dict) --
A policy that puts limits on the number of game sessions that a player can create within a specified span of time. With this policy, you can control players' ability to consume available resources.
The policy is evaluated when a player tries to create a new game session. On receiving a CreateGameSession
request, GameLift checks that the player (identified by CreatorId
) has created fewer than game session limit in the specified time period.
NewGameSessionsPerCreator (integer) --
A policy that puts limits on the number of game sessions that a player can create within a specified span of time. With this policy, you can control players' ability to consume available resources.
The policy is evaluated when a player tries to create a new game session. On receiving a CreateGameSession
request, GameLift checks that the player (identified by CreatorId
) has created fewer than game session limit in the specified time period.
PolicyPeriodInMinutes (integer) --
The time span used in evaluating the resource creation limit policy.
MetricGroups (list) --
Name of a metric group that metrics for this fleet are added to. In Amazon CloudWatch, you can view aggregated metrics for fleets that are in a metric group. A fleet can be included in only one metric group at a time.
StoppedActions (list) --
A list of fleet activity that has been suspended using StopFleetActions . This includes fleet auto-scaling.
InstanceRoleArn (string) --
A unique identifier for an IAM role that manages access to your Amazon Web Services services. With an instance role ARN set, any application that runs on an instance in this fleet can assume the role, including install scripts, server processes, and daemons (background processes). Create a role or look up a role's ARN by using the IAM dashboard in the Amazon Web Services Management Console. Learn more about using on-box credentials for your game servers at Access external resources from a game server.
CertificateConfiguration (dict) --
Determines whether a TLS/SSL certificate is generated for a fleet. This feature must be enabled when creating the fleet. All instances in a fleet share the same certificate. The certificate can be retrieved by calling the GameLift Server SDK operation GetInstanceCertificate
.
CertificateType (string) --
Indicates whether a TLS/SSL certificate is generated for a fleet.
Valid values include:
ComputeType (string) --
The type of compute resource used to host your game servers. You can use your own compute resources with GameLift Anywhere or use Amazon EC2 instances with managed GameLift.
AnywhereConfiguration (dict) --
GameLift Anywhere configuration options for your Anywhere fleets.
Cost (string) --
The cost to run your fleet per hour. GameLift uses the provided cost of your fleet to balance usage in queues. For more information about queues, see Setting up queues.
LocationStates (list) --
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, 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.
(dict) --
A fleet location and its life-cycle state. A location state object might be used to describe a fleet's remote location or home Region. Life-cycle state tracks the progress of launching the first instance in a new location and preparing it for game hosting, and then removing all instances and deleting the location from the fleet.
Location (string) --
The fleet location, expressed as an Amazon Web Services Region code such as us-west-2
.
Status (string) --
The life-cycle status of a fleet location.
Exceptions
GameLift.Client.exceptions.InternalServiceException
GameLift.Client.exceptions.NotFoundException
GameLift.Client.exceptions.ConflictException
GameLift.Client.exceptions.LimitExceededException
GameLift.Client.exceptions.InvalidRequestException
GameLift.Client.exceptions.UnauthorizedException
GameLift.Client.exceptions.TaggingFailedException
GameLift.Client.exceptions.UnsupportedRegionException