2017/05/16 - Amazon GameLift - 7 updated api methods
Changes Allow developers to specify how metrics are grouped in CloudWatch for their GameLift fleets. Developers can also specify how many concurrent game sessions activate on a per-instance basis.
{'MetricGroups': ['string'], 'RuntimeConfiguration': {'GameSessionActivationTimeoutSeconds': 'integer', 'MaxConcurrentGameSessionActivations': 'integer'}}Response
{'FleetAttributes': {'MetricGroups': ['string']}}
Creates a new fleet to run your game servers. A fleet is a set of Amazon Elastic Compute Cloud (Amazon EC2) instances, each of which can run multiple server processes to host game sessions. You configure a fleet to create instances with certain hardware specifications (see Amazon EC2 Instance Types for more information), and deploy a specified game build to each instance. A newly created fleet passes through several statuses; once it reaches the ACTIVE status, it can begin hosting game sessions.
To create a new fleet, you must specify the following: (1) fleet name, (2) build ID of an uploaded game build, (3) an EC2 instance type, and (4) a runtime configuration that describes which server processes to run on each instance in the fleet. (Although the runtime configuration is not a required parameter, the fleet cannot be successfully created without it.) You can also configure the new fleet with the following settings: fleet description, access permissions for inbound traffic, fleet-wide game session protection, and resource creation limit. If you use Amazon CloudWatch for metrics, you can add the new fleet to a metric group, which allows you to view aggregated metrics for a set of fleets. Once you specify a metric group, the new fleet's metrics are included in the metric group's data.
If the CreateFleet call is successful, Amazon GameLift performs the following tasks:
Creates a fleet record and sets the status to NEW (followed by other statuses as the fleet is activated).
Sets the fleet's capacity to 1 "desired", which causes Amazon GameLift to start one new EC2 instance.
Starts launching server processes on the instance. If the fleet is configured to run multiple server processes per instance, Amazon GameLift staggers each launch by a few seconds.
Begins writing events to the fleet event log, which can be accessed in the Amazon GameLift console.
Sets the fleet's status to ACTIVE once one server process in the fleet is ready to host a game session.
After a fleet is created, use the following actions to change fleet properties and configuration:
UpdateFleetAttributes -- Update fleet metadata, including name and description.
UpdateFleetCapacity -- Increase or decrease the number of instances you want the fleet to maintain.
UpdateFleetPortSettings -- Change the IP address and port ranges that allow access to incoming traffic.
UpdateRuntimeConfiguration -- Change how server processes are launched in the fleet, including launch path, launch parameters, and the number of concurrent processes.
PutScalingPolicy -- Create or update rules that are used to set the fleet's capacity (autoscaling).
See also: AWS API Documentation
Request Syntax
client.create_fleet( Name='string', Description='string', BuildId='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'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge', 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', ] )
string
[REQUIRED]
Descriptive label that is associated with a fleet. Fleet names do not need to be unique.
string
Human-readable description of a fleet.
string
[REQUIRED]
Unique identifier for a build to be deployed on the new fleet. The build must have been successfully uploaded to Amazon GameLift and be in a READY status. This fleet setting cannot be changed once the fleet is created.
string
This parameter is no longer used. Instead, specify a server launch path using the RuntimeConfiguration parameter. (Requests that specify a server launch path and launch parameters instead of a runtime configuration will continue to work.)
string
This parameter is no longer used. Instead, specify server launch parameters in the RuntimeConfiguration parameter. (Requests that specify a server launch path and launch parameters instead of a runtime configuration will continue to work.)
list
This parameter is no longer used. Instead, 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 in logParameters . See more information in the Server API Reference .
(string) --
string
[REQUIRED]
Name of an EC2 instance type that is supported in Amazon GameLift. A fleet instance type determines the computing resources of each instance in the fleet, including CPU, memory, storage, and networking capacity. Amazon GameLift supports the following EC2 instance types. See Amazon EC2 Instance Types for detailed descriptions.
list
Range of IP addresses and port settings that permit inbound traffic to access server processes running on the fleet. If no inbound permissions are set, including both IP address range and port range, the server processes in the fleet cannot accept connections. You can specify one or more sets of permissions for a fleet.
(dict) --
A range of IP addresses and port settings that allow inbound traffic to connect to server processes on Amazon GameLift. Each game session hosted on a fleet is assigned a unique combination of IP address and port number, which must fall into the fleet's allowed ranges. This combination is included in the GameSession object.
FromPort (integer) -- [REQUIRED]
Starting value for a range of allowed port numbers.
ToPort (integer) -- [REQUIRED]
Ending value for a range of allowed port numbers. Port numbers are end-inclusive. This value must be higher than FromPort .
IpRange (string) -- [REQUIRED]
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] ".
Protocol (string) -- [REQUIRED]
Network communication protocol used by the fleet.
string
Game session protection policy to apply to all instances in this fleet. If this parameter is not set, instances in this fleet default to no protection. You can change a fleet's protection policy using UpdateFleetAttributes, but this change will only affect sessions created after the policy change. You can also set protection for individual instances using UpdateGameSession .
NoProtection – The game session can be terminated during a scale-down event.
FullProtection – If the game session is in an ACTIVE status, it cannot be terminated during a scale-down event.
dict
Instructions for launching server processes on each instance in the fleet. The runtime configuration for a fleet has a collection of server process configurations, one for each type of server process to run on an instance. A server process configuration specifies the location of the server executable, launch parameters, and the number of concurrent processes with that configuration to maintain on each instance. A CreateFleet request must include a runtime configuration with at least one server process configuration; otherwise the request will fail with an invalid request exception. (This parameter replaces the parameters ServerLaunchPath and ServerLaunchParameters ; requests that contain values for these parameters instead of a runtime configuration will continue to work.)
ServerProcesses (list) --
Collection of server process configurations that describe which server processes to run on each instance in a fleet.
(dict) --
A set of instructions for launching server processes on each instance in a fleet. Each instruction set identifies the location of the server executable, optional launch parameters, and the number of server processes with this configuration to maintain concurrently on the instance. Server process configurations make up a fleet's `` RuntimeConfiguration `` .
LaunchPath (string) -- [REQUIRED]
Location of the server executable in a game build. All game builds are installed on instances at the root : for Windows instances C:\game , and for Linux instances /local/game . A Windows game build with an executable file located at MyGame\latest\server.exe must have a launch path of "C:\game\MyGame\latest\server.exe ". A Linux game build with an executable file located at MyGame/latest/server.exe must have a launch path of "/local/game/MyGame/latest/server.exe ".
Parameters (string) --
Optional list of parameters to pass to the server executable on launch.
ConcurrentExecutions (integer) -- [REQUIRED]
Number of server processes using this configuration to run concurrently on an instance.
MaxConcurrentGameSessionActivations (integer) --
Maximum number of game sessions with status ACTIVATING to allow on an instance simultaneously. This setting limits the amount of instance resources that can be used for new game activations at any one time.
GameSessionActivationTimeoutSeconds (integer) --
Maximum amount of time (in seconds) that a game session can remain in status ACTIVATING. If the game session is not active before the timeout, activation is terminated and the game session status is changed to TERMINATED.
dict
Policy that limits the number of game sessions an individual player can create over a span of time for this fleet.
NewGameSessionsPerCreator (integer) --
Maximum number of game sessions that an individual can create during the policy period.
PolicyPeriodInMinutes (integer) --
Time span used in evaluating the resource creation limit policy.
list
Names of metric groups to add this fleet to. Use an existing metric group name to add this fleet to the group, or use a new name to create a new metric group. Currently, a fleet can only be included in one metric group at a time.
(string) --
dict
Response Syntax
{ 'FleetAttributes': { 'FleetId': 'string', 'FleetArn': 'string', 'Description': 'string', 'Name': 'string', 'CreationTime': datetime(2015, 1, 1), 'TerminationTime': datetime(2015, 1, 1), 'Status': 'NEW'|'DOWNLOADING'|'VALIDATING'|'BUILDING'|'ACTIVATING'|'ACTIVE'|'DELETING'|'ERROR'|'TERMINATED', 'BuildId': 'string', 'ServerLaunchPath': 'string', 'ServerLaunchParameters': 'string', 'LogPaths': [ 'string', ], 'NewGameSessionProtectionPolicy': 'NoProtection'|'FullProtection', 'OperatingSystem': 'WINDOWS_2012'|'AMAZON_LINUX', 'ResourceCreationLimitPolicy': { 'NewGameSessionsPerCreator': 123, 'PolicyPeriodInMinutes': 123 }, 'MetricGroups': [ 'string', ] } }
Response Structure
(dict) --
Represents the returned data in response to a request action.
FleetAttributes (dict) --
Properties for the newly created fleet.
FleetId (string) --
Unique identifier for a fleet.
FleetArn (string) --
Identifier for a fleet that is unique across all regions.
Description (string) --
Human-readable description of the fleet.
Name (string) --
Descriptive label that is associated with a fleet. Fleet names do not need to be unique.
CreationTime (datetime) --
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) --
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:
NEW – A new fleet has been defined and desired instances is set to 1.
DOWNLOADING/VALIDATING/BUILDING/ACTIVATING – Amazon GameLift is setting up the new fleet, creating new instances with the game build and starting server processes.
ACTIVE – Hosts can now accept game sessions.
ERROR – An error occurred when downloading, validating, building, or activating the fleet.
DELETING – Hosts are responding to a delete fleet request.
TERMINATED – The fleet no longer exists.
BuildId (string) --
Unique identifier for a build.
ServerLaunchPath (string) --
Path to a game server executable in the fleet's build, specified for fleets created prior to 2016-08-04 (or AWS SDK v. 0.12.16). Server launch paths for fleets created after this date are specified in the fleet's RuntimeConfiguration .
ServerLaunchParameters (string) --
Game server launch parameters specified for fleets created prior to 2016-08-04 (or AWS SDK v. 0.12.16). Server launch parameters for fleets created after this date are specified in the fleet's RuntimeConfiguration .
LogPaths (list) --
Location of default log files. When a server process is shut down, Amazon GameLift captures and stores any log files in this location. These logs are in addition to game session logs; see more on game session logs in the Amazon GameLift Developer Guide . If no default log path for a fleet is specified, Amazon GameLift will automatically upload logs that are stored on each instance at C:\game\logs (for Windows) or /local/game/logs (for Linux). Use the Amazon GameLift console to access stored logs.
(string) --
NewGameSessionProtectionPolicy (string) --
Type of game session protection to set for all new instances started in the fleet.
NoProtection – The game session can be terminated during a scale-down event.
FullProtection – If the game session is in an ACTIVE status, it cannot be terminated during a scale-down event.
OperatingSystem (string) --
Operating system of the fleet's computing resources. A fleet's operating system depends on the OS specified for the build that is deployed on this fleet.
ResourceCreationLimitPolicy (dict) --
Fleet policy to limit the number of game sessions an individual player can create over a span of time.
NewGameSessionsPerCreator (integer) --
Maximum number of game sessions that an individual can create during the policy period.
PolicyPeriodInMinutes (integer) --
Time span used in evaluating the resource creation limit policy.
MetricGroups (list) --
Names of metric groups that this fleet is included in. In Amazon CloudWatch, you can view metrics for an individual fleet or aggregated metrics for a fleets that are in a fleet metric group. Currently, a fleet can be included in only one metric group at a time.
(string) --
{'FleetAttributes': {'MetricGroups': ['string']}}
Retrieves fleet properties, including metadata, status, and configuration, for one or more fleets. You can request attributes for all fleets, or specify a list of one or more fleet IDs. When requesting multiple fleets, use the pagination parameters to retrieve results as a set of sequential pages. If successful, a FleetAttributes object is returned for each requested fleet ID. When specifying a list of fleet IDs, attribute objects are returned only for fleets that currently exist.
Note
Some API actions may limit the number of fleet IDs allowed in one request. If a request exceeds this limit, the request fails and the error message includes the maximum allowed.
See also: AWS API Documentation
Request Syntax
client.describe_fleet_attributes( FleetIds=[ 'string', ], Limit=123, NextToken='string' )
list
Unique identifier for a fleet(s) to retrieve attributes for. To request attributes for all fleets, leave this parameter empty.
(string) --
integer
Maximum number of results to return. Use this parameter with NextToken to get results as a set of sequential pages. This parameter is ignored when the request specifies one or a list of fleet IDs.
string
Token that indicates the start of the next sequential page of results. Use the token that is returned with a previous call to this action. To specify the start of the result set, do not specify a value. This parameter is ignored when the request specifies one or a list of fleet IDs.
dict
Response Syntax
{ 'FleetAttributes': [ { 'FleetId': 'string', 'FleetArn': 'string', 'Description': 'string', 'Name': 'string', 'CreationTime': datetime(2015, 1, 1), 'TerminationTime': datetime(2015, 1, 1), 'Status': 'NEW'|'DOWNLOADING'|'VALIDATING'|'BUILDING'|'ACTIVATING'|'ACTIVE'|'DELETING'|'ERROR'|'TERMINATED', 'BuildId': 'string', 'ServerLaunchPath': 'string', 'ServerLaunchParameters': 'string', 'LogPaths': [ 'string', ], 'NewGameSessionProtectionPolicy': 'NoProtection'|'FullProtection', 'OperatingSystem': 'WINDOWS_2012'|'AMAZON_LINUX', 'ResourceCreationLimitPolicy': { 'NewGameSessionsPerCreator': 123, 'PolicyPeriodInMinutes': 123 }, 'MetricGroups': [ 'string', ] }, ], 'NextToken': 'string' }
Response Structure
(dict) --
Represents the returned data in response to a request action.
FleetAttributes (list) --
Collection of objects containing attribute metadata for each requested fleet ID.
(dict) --
General properties describing a fleet.
FleetId (string) --
Unique identifier for a fleet.
FleetArn (string) --
Identifier for a fleet that is unique across all regions.
Description (string) --
Human-readable description of the fleet.
Name (string) --
Descriptive label that is associated with a fleet. Fleet names do not need to be unique.
CreationTime (datetime) --
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) --
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:
NEW – A new fleet has been defined and desired instances is set to 1.
DOWNLOADING/VALIDATING/BUILDING/ACTIVATING – Amazon GameLift is setting up the new fleet, creating new instances with the game build and starting server processes.
ACTIVE – Hosts can now accept game sessions.
ERROR – An error occurred when downloading, validating, building, or activating the fleet.
DELETING – Hosts are responding to a delete fleet request.
TERMINATED – The fleet no longer exists.
BuildId (string) --
Unique identifier for a build.
ServerLaunchPath (string) --
Path to a game server executable in the fleet's build, specified for fleets created prior to 2016-08-04 (or AWS SDK v. 0.12.16). Server launch paths for fleets created after this date are specified in the fleet's RuntimeConfiguration .
ServerLaunchParameters (string) --
Game server launch parameters specified for fleets created prior to 2016-08-04 (or AWS SDK v. 0.12.16). Server launch parameters for fleets created after this date are specified in the fleet's RuntimeConfiguration .
LogPaths (list) --
Location of default log files. When a server process is shut down, Amazon GameLift captures and stores any log files in this location. These logs are in addition to game session logs; see more on game session logs in the Amazon GameLift Developer Guide . If no default log path for a fleet is specified, Amazon GameLift will automatically upload logs that are stored on each instance at C:\game\logs (for Windows) or /local/game/logs (for Linux). Use the Amazon GameLift console to access stored logs.
(string) --
NewGameSessionProtectionPolicy (string) --
Type of game session protection to set for all new instances started in the fleet.
NoProtection – The game session can be terminated during a scale-down event.
FullProtection – If the game session is in an ACTIVE status, it cannot be terminated during a scale-down event.
OperatingSystem (string) --
Operating system of the fleet's computing resources. A fleet's operating system depends on the OS specified for the build that is deployed on this fleet.
ResourceCreationLimitPolicy (dict) --
Fleet policy to limit the number of game sessions an individual player can create over a span of time.
NewGameSessionsPerCreator (integer) --
Maximum number of game sessions that an individual can create during the policy period.
PolicyPeriodInMinutes (integer) --
Time span used in evaluating the resource creation limit policy.
MetricGroups (list) --
Names of metric groups that this fleet is included in. In Amazon CloudWatch, you can view metrics for an individual fleet or aggregated metrics for a fleets that are in a fleet metric group. Currently, a fleet can be included in only one metric group at a time.
(string) --
NextToken (string) --
Token that indicates where to resume retrieving results on the next call to this action. If no token is returned, these results represent the end of the list.
{'RuntimeConfiguration': {'GameSessionActivationTimeoutSeconds': 'integer', 'MaxConcurrentGameSessionActivations': 'integer'}}
Retrieves the current runtime configuration for the specified fleet. The runtime configuration tells Amazon GameLift how to launch server processes on instances in the fleet.
See also: AWS API Documentation
Request Syntax
client.describe_runtime_configuration( FleetId='string' )
string
[REQUIRED]
Unique identifier for a fleet to get the runtime configuration for.
dict
Response Syntax
{ 'RuntimeConfiguration': { 'ServerProcesses': [ { 'LaunchPath': 'string', 'Parameters': 'string', 'ConcurrentExecutions': 123 }, ], 'MaxConcurrentGameSessionActivations': 123, 'GameSessionActivationTimeoutSeconds': 123 } }
Response Structure
(dict) --
Represents the returned data in response to a request action.
RuntimeConfiguration (dict) --
Instructions describing how server processes should be launched and maintained on each instance in the fleet.
ServerProcesses (list) --
Collection of server process configurations that describe which server processes to run on each instance in a fleet.
(dict) --
A set of instructions for launching server processes on each instance in a fleet. Each instruction set identifies the location of the server executable, optional launch parameters, and the number of server processes with this configuration to maintain concurrently on the instance. Server process configurations make up a fleet's `` RuntimeConfiguration `` .
LaunchPath (string) --
Location of the server executable in a game build. All game builds are installed on instances at the root : for Windows instances C:\game , and for Linux instances /local/game . A Windows game build with an executable file located at MyGame\latest\server.exe must have a launch path of "C:\game\MyGame\latest\server.exe ". A Linux game build with an executable file located at MyGame/latest/server.exe must have a launch path of "/local/game/MyGame/latest/server.exe ".
Parameters (string) --
Optional list of parameters to pass to the server executable on launch.
ConcurrentExecutions (integer) --
Number of server processes using this configuration to run concurrently on an instance.
MaxConcurrentGameSessionActivations (integer) --
Maximum number of game sessions with status ACTIVATING to allow on an instance simultaneously. This setting limits the amount of instance resources that can be used for new game activations at any one time.
GameSessionActivationTimeoutSeconds (integer) --
Maximum amount of time (in seconds) that a game session can remain in status ACTIVATING. If the game session is not active before the timeout, activation is terminated and the game session status is changed to TERMINATED.
{'ScalingPolicies': {'MetricName': ['PercentAvailableGameSessions', 'AvailableGameSessions', 'PercentIdleInstances']}}
Retrieves all scaling policies applied to a fleet.
To get a fleet's scaling policies, specify the fleet ID. You can filter this request by policy status, such as to retrieve only active scaling policies. Use the pagination parameters to retrieve results as a set of sequential pages. If successful, set of ScalingPolicy objects is returned for the fleet.
See also: AWS API Documentation
Request Syntax
client.describe_scaling_policies( FleetId='string', StatusFilter='ACTIVE'|'UPDATE_REQUESTED'|'UPDATING'|'DELETE_REQUESTED'|'DELETING'|'DELETED'|'ERROR', Limit=123, NextToken='string' )
string
[REQUIRED]
Unique identifier for a fleet to retrieve scaling policies for.
string
Scaling policy status to filter results on. A scaling policy is only in force when in an ACTIVE status.
ACTIVE – The scaling policy is currently in force.
UPDATEREQUESTED – A request to update the scaling policy has been received.
UPDATING – A change is being made to the scaling policy.
DELETEREQUESTED – A request to delete the scaling policy has been received.
DELETING – The scaling policy is being deleted.
DELETED – The scaling policy has been deleted.
ERROR – An error occurred in creating the policy. It should be removed and recreated.
integer
Maximum number of results to return. Use this parameter with NextToken to get results as a set of sequential pages.
string
Token that indicates the start of the next sequential page of results. Use the token that is returned with a previous call to this action. To specify the start of the result set, do not specify a value.
dict
Response Syntax
{ 'ScalingPolicies': [ { 'FleetId': 'string', 'Name': 'string', 'Status': 'ACTIVE'|'UPDATE_REQUESTED'|'UPDATING'|'DELETE_REQUESTED'|'DELETING'|'DELETED'|'ERROR', 'ScalingAdjustment': 123, 'ScalingAdjustmentType': 'ChangeInCapacity'|'ExactCapacity'|'PercentChangeInCapacity', 'ComparisonOperator': 'GreaterThanOrEqualToThreshold'|'GreaterThanThreshold'|'LessThanThreshold'|'LessThanOrEqualToThreshold', 'Threshold': 123.0, 'EvaluationPeriods': 123, 'MetricName': 'ActivatingGameSessions'|'ActiveGameSessions'|'ActiveInstances'|'AvailableGameSessions'|'AvailablePlayerSessions'|'CurrentPlayerSessions'|'IdleInstances'|'PercentAvailableGameSessions'|'PercentIdleInstances'|'QueueDepth'|'WaitTime' }, ], 'NextToken': 'string' }
Response Structure
(dict) --
Represents the returned data in response to a request action.
ScalingPolicies (list) --
Collection of objects containing the scaling policies matching the request.
(dict) --
Rule that controls how a fleet is scaled. Scaling policies are uniquely identified by the combination of name and fleet ID.
FleetId (string) --
Unique identifier for a fleet that is associated with this scaling policy.
Name (string) --
Descriptive label that is associated with a scaling policy. Policy names do not need to be unique.
Status (string) --
Current status of the scaling policy. The scaling policy is only in force when in an ACTIVE status.
ACTIVE – The scaling policy is currently in force.
UPDATE_REQUESTED – A request to update the scaling policy has been received.
UPDATING – A change is being made to the scaling policy.
DELETE_REQUESTED – A request to delete the scaling policy has been received.
DELETING – The scaling policy is being deleted.
DELETED – The scaling policy has been deleted.
ERROR – An error occurred in creating the policy. It should be removed and recreated.
ScalingAdjustment (integer) --
Amount of adjustment to make, based on the scaling adjustment type.
ScalingAdjustmentType (string) --
Type of adjustment to make to a fleet's instance count (see FleetCapacity ):
ChangeInCapacity – add (or subtract) the scaling adjustment value from the current instance count. Positive values scale up while negative values scale down.
ExactCapacity – set the instance count to the scaling adjustment value.
PercentChangeInCapacity – increase or reduce the current instance count by the scaling adjustment, read as a percentage. Positive values scale up while negative values scale down.
ComparisonOperator (string) --
Comparison operator to use when measuring a metric against the threshold value.
Threshold (float) --
Metric value used to trigger a scaling event.
EvaluationPeriods (integer) --
Length of time (in minutes) the metric must be at or beyond the threshold before a scaling event is triggered.
MetricName (string) --
Name of the Amazon GameLift-defined metric that is used to trigger an adjustment.
ActivatingGameSessions – number of game sessions in the process of being created (game session status = ACTIVATING ).
ActiveGameSessions – number of game sessions currently running (game session status = ACTIVE ).
CurrentPlayerSessions – number of active or reserved player sessions (player session status = ACTIVE or RESERVED ).
AvailablePlayerSessions – number of player session slots currently available in active game sessions across the fleet, calculated by subtracting a game session's current player session count from its maximum player session count. This number does include game sessions that are not currently accepting players (game session PlayerSessionCreationPolicy = DENY_ALL ).
ActiveInstances – number of instances currently running a game session.
IdleInstances – number of instances not currently running a game session.
NextToken (string) --
Token that indicates where to resume retrieving results on the next call to this action. If no token is returned, these results represent the end of the list.
{'MetricName': ['PercentAvailableGameSessions', 'AvailableGameSessions', 'PercentIdleInstances']}
Creates or updates a scaling policy for a fleet. An active scaling policy prompts Amazon GameLift to track a certain metric for a fleet and automatically change the fleet's capacity in specific circumstances. Each scaling policy contains one rule statement. Fleets can have multiple scaling policies in force simultaneously.
A scaling policy rule statement has the following structure:
If [MetricName] is [ComparisonOperator] [Threshold] for [EvaluationPeriods] minutes, then [ScalingAdjustmentType] to/by [ScalingAdjustment] .
For example, this policy: "If the number of idle instances exceeds 20 for more than 15 minutes, then reduce the fleet capacity by 10 instances" could be implemented as the following rule statement:
If [IdleInstances] is [GreaterThanOrEqualToThreshold] [20] for [15] minutes, then [ChangeInCapacity] by [-10].
To create or update a scaling policy, specify a unique combination of name and fleet ID, and set the rule values. All parameters for this action are required. If successful, the policy name is returned. Scaling policies cannot be suspended or made inactive. To stop enforcing a scaling policy, call DeleteScalingPolicy .
See also: AWS API Documentation
Request Syntax
client.put_scaling_policy( Name='string', FleetId='string', ScalingAdjustment=123, ScalingAdjustmentType='ChangeInCapacity'|'ExactCapacity'|'PercentChangeInCapacity', Threshold=123.0, ComparisonOperator='GreaterThanOrEqualToThreshold'|'GreaterThanThreshold'|'LessThanThreshold'|'LessThanOrEqualToThreshold', EvaluationPeriods=123, MetricName='ActivatingGameSessions'|'ActiveGameSessions'|'ActiveInstances'|'AvailableGameSessions'|'AvailablePlayerSessions'|'CurrentPlayerSessions'|'IdleInstances'|'PercentAvailableGameSessions'|'PercentIdleInstances'|'QueueDepth'|'WaitTime' )
string
[REQUIRED]
Descriptive label that is associated with a scaling policy. Policy names do not need to be unique. A fleet can have only one scaling policy with the same name.
string
[REQUIRED]
Unique identifier for a fleet to apply this policy to.
integer
[REQUIRED]
Amount of adjustment to make, based on the scaling adjustment type.
string
[REQUIRED]
Type of adjustment to make to a fleet's instance count (see FleetCapacity ):
ChangeInCapacity – add (or subtract) the scaling adjustment value from the current instance count. Positive values scale up while negative values scale down.
ExactCapacity – set the instance count to the scaling adjustment value.
PercentChangeInCapacity – increase or reduce the current instance count by the scaling adjustment, read as a percentage. Positive values scale up while negative values scale down; for example, a value of "-10" scales the fleet down by 10%.
float
[REQUIRED]
Metric value used to trigger a scaling event.
string
[REQUIRED]
Comparison operator to use when measuring the metric against the threshold value.
integer
[REQUIRED]
Length of time (in minutes) the metric must be at or beyond the threshold before a scaling event is triggered.
string
[REQUIRED]
Name of the Amazon GameLift-defined metric that is used to trigger an adjustment.
ActivatingGameSessions – number of game sessions in the process of being created (game session status = ACTIVATING ).
ActiveGameSessions – number of game sessions currently running (game session status = ACTIVE ).
CurrentPlayerSessions – number of active or reserved player sessions (player session status = ACTIVE or RESERVED ).
AvailablePlayerSessions – number of player session slots currently available in active game sessions across the fleet, calculated by subtracting a game session's current player session count from its maximum player session count. This number includes game sessions that are not currently accepting players (game session PlayerSessionCreationPolicy = DENY_ALL ).
ActiveInstances – number of instances currently running a game session.
IdleInstances – number of instances not currently running a game session.
dict
Response Syntax
{ 'Name': 'string' }
Response Structure
(dict) --
Represents the returned data in response to a request action.
Name (string) --
Descriptive label that is associated with a scaling policy. Policy names do not need to be unique.
{'MetricGroups': ['string']}
Updates fleet properties, including name and description, for a fleet. To update metadata, specify the fleet ID and the property values you want to change. If successful, the fleet ID for the updated fleet is returned.
See also: AWS API Documentation
Request Syntax
client.update_fleet_attributes( FleetId='string', Name='string', Description='string', NewGameSessionProtectionPolicy='NoProtection'|'FullProtection', ResourceCreationLimitPolicy={ 'NewGameSessionsPerCreator': 123, 'PolicyPeriodInMinutes': 123 }, MetricGroups=[ 'string', ] )
string
[REQUIRED]
Unique identifier for a fleet to update attribute metadata for.
string
Descriptive label that is associated with a fleet. Fleet names do not need to be unique.
string
Human-readable description of a fleet.
string
Game session protection policy to apply to all new instances created in this fleet. Instances that already exist are not affected. You can set protection for individual instances using UpdateGameSession .
NoProtection – The game session can be terminated during a scale-down event.
FullProtection – If the game session is in an ACTIVE status, it cannot be terminated during a scale-down event.
dict
Policy that limits the number of game sessions an individual player can create over a span of time.
NewGameSessionsPerCreator (integer) --
Maximum number of game sessions that an individual can create during the policy period.
PolicyPeriodInMinutes (integer) --
Time span used in evaluating the resource creation limit policy.
list
Names of metric groups to include this fleet with. A fleet metric group is used in Amazon CloudWatch to aggregate metrics from multiple fleets. Use an existing metric group name to add this fleet to the group, or use a new name to create a new metric group. Currently, a fleet can only be included in one metric group at a time.
(string) --
dict
Response Syntax
{ 'FleetId': 'string' }
Response Structure
(dict) --
Represents the returned data in response to a request action.
FleetId (string) --
Unique identifier for a fleet that was updated.
{'RuntimeConfiguration': {'GameSessionActivationTimeoutSeconds': 'integer', 'MaxConcurrentGameSessionActivations': 'integer'}}
Updates the current runtime configuration for the specified fleet, which tells Amazon GameLift how to launch server processes on instances in the fleet. You can update a fleet's runtime configuration at any time after the fleet is created; it does not need to be in an ACTIVE status.
To update runtime configuration, specify the fleet ID and provide a RuntimeConfiguration object with the updated collection of server process configurations.
Each instance in a Amazon GameLift fleet checks regularly for an updated runtime configuration and changes how it launches server processes to comply with the latest version. Existing server processes are not affected by the update; they continue to run until they end, while Amazon GameLift simply adds new server processes to fit the current runtime configuration. As a result, the runtime configuration changes are applied gradually as existing processes shut down and new processes are launched in Amazon GameLift's normal process recycling activity.
See also: AWS API Documentation
Request Syntax
client.update_runtime_configuration( FleetId='string', RuntimeConfiguration={ 'ServerProcesses': [ { 'LaunchPath': 'string', 'Parameters': 'string', 'ConcurrentExecutions': 123 }, ], 'MaxConcurrentGameSessionActivations': 123, 'GameSessionActivationTimeoutSeconds': 123 } )
string
[REQUIRED]
Unique identifier for a fleet to update runtime configuration for.
dict
[REQUIRED]
Instructions for launching server processes on each instance in the fleet. The runtime configuration for a fleet has a collection of server process configurations, one for each type of server process to run on an instance. A server process configuration specifies the location of the server executable, launch parameters, and the number of concurrent processes with that configuration to maintain on each instance.
ServerProcesses (list) --
Collection of server process configurations that describe which server processes to run on each instance in a fleet.
(dict) --
A set of instructions for launching server processes on each instance in a fleet. Each instruction set identifies the location of the server executable, optional launch parameters, and the number of server processes with this configuration to maintain concurrently on the instance. Server process configurations make up a fleet's `` RuntimeConfiguration `` .
LaunchPath (string) -- [REQUIRED]
Location of the server executable in a game build. All game builds are installed on instances at the root : for Windows instances C:\game , and for Linux instances /local/game . A Windows game build with an executable file located at MyGame\latest\server.exe must have a launch path of "C:\game\MyGame\latest\server.exe ". A Linux game build with an executable file located at MyGame/latest/server.exe must have a launch path of "/local/game/MyGame/latest/server.exe ".
Parameters (string) --
Optional list of parameters to pass to the server executable on launch.
ConcurrentExecutions (integer) -- [REQUIRED]
Number of server processes using this configuration to run concurrently on an instance.
MaxConcurrentGameSessionActivations (integer) --
Maximum number of game sessions with status ACTIVATING to allow on an instance simultaneously. This setting limits the amount of instance resources that can be used for new game activations at any one time.
GameSessionActivationTimeoutSeconds (integer) --
Maximum amount of time (in seconds) that a game session can remain in status ACTIVATING. If the game session is not active before the timeout, activation is terminated and the game session status is changed to TERMINATED.
dict
Response Syntax
{ 'RuntimeConfiguration': { 'ServerProcesses': [ { 'LaunchPath': 'string', 'Parameters': 'string', 'ConcurrentExecutions': 123 }, ], 'MaxConcurrentGameSessionActivations': 123, 'GameSessionActivationTimeoutSeconds': 123 } }
Response Structure
(dict) --
Represents the returned data in response to a request action.
RuntimeConfiguration (dict) --
The runtime configuration currently in force. If the update was successful, this object matches the one in the request.
ServerProcesses (list) --
Collection of server process configurations that describe which server processes to run on each instance in a fleet.
(dict) --
A set of instructions for launching server processes on each instance in a fleet. Each instruction set identifies the location of the server executable, optional launch parameters, and the number of server processes with this configuration to maintain concurrently on the instance. Server process configurations make up a fleet's `` RuntimeConfiguration `` .
LaunchPath (string) --
Location of the server executable in a game build. All game builds are installed on instances at the root : for Windows instances C:\game , and for Linux instances /local/game . A Windows game build with an executable file located at MyGame\latest\server.exe must have a launch path of "C:\game\MyGame\latest\server.exe ". A Linux game build with an executable file located at MyGame/latest/server.exe must have a launch path of "/local/game/MyGame/latest/server.exe ".
Parameters (string) --
Optional list of parameters to pass to the server executable on launch.
ConcurrentExecutions (integer) --
Number of server processes using this configuration to run concurrently on an instance.
MaxConcurrentGameSessionActivations (integer) --
Maximum number of game sessions with status ACTIVATING to allow on an instance simultaneously. This setting limits the amount of instance resources that can be used for new game activations at any one time.
GameSessionActivationTimeoutSeconds (integer) --
Maximum amount of time (in seconds) that a game session can remain in status ACTIVATING. If the game session is not active before the timeout, activation is terminated and the game session status is changed to TERMINATED.