

This is the new *Amazon CloudFormation Template Reference Guide*. Please update your bookmarks and links. For help getting started with CloudFormation, see the [Amazon CloudFormation User Guide](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/Welcome.html).

# AWS::GameLift::Fleet ScalingPolicy
<a name="aws-properties-gamelift-fleet-scalingpolicy"></a>

Rule that controls how a fleet is scaled. Scaling policies are uniquely identified by the combination of name and fleet ID.

## Syntax
<a name="aws-properties-gamelift-fleet-scalingpolicy-syntax"></a>

To declare this entity in your Amazon CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-gamelift-fleet-scalingpolicy-syntax.json"></a>

```
{
  "[ComparisonOperator](#cfn-gamelift-fleet-scalingpolicy-comparisonoperator)" : {{String}},
  "[EvaluationPeriods](#cfn-gamelift-fleet-scalingpolicy-evaluationperiods)" : {{Integer}},
  "[Location](#cfn-gamelift-fleet-scalingpolicy-location)" : {{String}},
  "[MetricName](#cfn-gamelift-fleet-scalingpolicy-metricname)" : {{String}},
  "[Name](#cfn-gamelift-fleet-scalingpolicy-name)" : {{String}},
  "[PolicyType](#cfn-gamelift-fleet-scalingpolicy-policytype)" : {{String}},
  "[ScalingAdjustment](#cfn-gamelift-fleet-scalingpolicy-scalingadjustment)" : {{Integer}},
  "[ScalingAdjustmentType](#cfn-gamelift-fleet-scalingpolicy-scalingadjustmenttype)" : {{String}},
  "[Status](#cfn-gamelift-fleet-scalingpolicy-status)" : {{String}},
  "[TargetConfiguration](#cfn-gamelift-fleet-scalingpolicy-targetconfiguration)" : {{TargetConfiguration}},
  "[Threshold](#cfn-gamelift-fleet-scalingpolicy-threshold)" : {{Number}},
  "[UpdateStatus](#cfn-gamelift-fleet-scalingpolicy-updatestatus)" : {{String}}
}
```

### YAML
<a name="aws-properties-gamelift-fleet-scalingpolicy-syntax.yaml"></a>

```
  [ComparisonOperator](#cfn-gamelift-fleet-scalingpolicy-comparisonoperator): {{String}}
  [EvaluationPeriods](#cfn-gamelift-fleet-scalingpolicy-evaluationperiods): {{Integer}}
  [Location](#cfn-gamelift-fleet-scalingpolicy-location): {{String}}
  [MetricName](#cfn-gamelift-fleet-scalingpolicy-metricname): {{String}}
  [Name](#cfn-gamelift-fleet-scalingpolicy-name): {{String}}
  [PolicyType](#cfn-gamelift-fleet-scalingpolicy-policytype): {{String}}
  [ScalingAdjustment](#cfn-gamelift-fleet-scalingpolicy-scalingadjustment): {{Integer}}
  [ScalingAdjustmentType](#cfn-gamelift-fleet-scalingpolicy-scalingadjustmenttype): {{String}}
  [Status](#cfn-gamelift-fleet-scalingpolicy-status): {{String}}
  [TargetConfiguration](#cfn-gamelift-fleet-scalingpolicy-targetconfiguration): {{
    TargetConfiguration}}
  [Threshold](#cfn-gamelift-fleet-scalingpolicy-threshold): {{Number}}
  [UpdateStatus](#cfn-gamelift-fleet-scalingpolicy-updatestatus): {{String}}
```

## Properties
<a name="aws-properties-gamelift-fleet-scalingpolicy-properties"></a>

`ComparisonOperator`  <a name="cfn-gamelift-fleet-scalingpolicy-comparisonoperator"></a>
Comparison operator to use when measuring a metric against the threshold value.  
*Required*: No  
*Type*: String  
*Allowed values*: `GreaterThanOrEqualToThreshold | GreaterThanThreshold | LessThanThreshold | LessThanOrEqualToThreshold`  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`EvaluationPeriods`  <a name="cfn-gamelift-fleet-scalingpolicy-evaluationperiods"></a>
Length of time (in minutes) the metric must be at or beyond the threshold before a scaling event is triggered.  
*Required*: No  
*Type*: Integer  
*Minimum*: `1`  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Location`  <a name="cfn-gamelift-fleet-scalingpolicy-location"></a>
 The fleet location.   
*Required*: No  
*Type*: String  
*Pattern*: `^[A-Za-z0-9\-]+`  
*Minimum*: `1`  
*Maximum*: `64`  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`MetricName`  <a name="cfn-gamelift-fleet-scalingpolicy-metricname"></a>
Name of the Amazon GameLift Servers-defined metric that is used to trigger a scaling adjustment. For detailed descriptions of fleet metrics, see [Monitor Amazon GameLift Servers with Amazon CloudWatch](https://docs.amazonaws.cn/gamelift/latest/developerguide/monitoring-cloudwatch.html).   
+ **ActivatingGameSessions** -- Game sessions in the process of being created.
+ **ActiveGameSessions** -- Game sessions that are currently running.
+ **ActiveInstances** -- Fleet instances that are currently running at least one game session.
+ **AvailableGameSessions** -- Additional game sessions that fleet could host simultaneously, given current capacity.
+ **AvailablePlayerSessions** -- Empty player slots in currently active game sessions. This includes game sessions that are not currently accepting players. Reserved player slots are not included.
+ **CurrentPlayerSessions** -- Player slots in active game sessions that are being used by a player or are reserved for a player. 
+ **IdleInstances** -- Active instances that are currently hosting zero game sessions. 
+ **PercentAvailableGameSessions** -- Unused percentage of the total number of game sessions that a fleet could host simultaneously, given current capacity. Use this metric for a target-based scaling policy.
+ **PercentIdleInstances** -- Percentage of the total number of active instances that are hosting zero game sessions.
+ **QueueDepth** -- Pending game session placement requests, in any queue, where the current fleet is the top-priority destination.
+ **WaitTime** -- Current wait time for pending game session placement requests, in any queue, where the current fleet is the top-priority destination. 
*Required*: Yes  
*Type*: String  
*Allowed values*: `ActivatingGameSessions | ActiveGameSessions | ActiveInstances | AvailableGameSessions | AvailablePlayerSessions | CurrentPlayerSessions | IdleInstances | PercentAvailableGameSessions | PercentIdleInstances | QueueDepth | WaitTime | ConcurrentActivatableGameSessions`  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Name`  <a name="cfn-gamelift-fleet-scalingpolicy-name"></a>
A descriptive label that is associated with a fleet's scaling policy. Policy names do not need to be unique.  
*Required*: Yes  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `1024`  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`PolicyType`  <a name="cfn-gamelift-fleet-scalingpolicy-policytype"></a>
The type of scaling policy to create. For a target-based policy, set the parameter *MetricName* to 'PercentAvailableGameSessions' and specify a *TargetConfiguration*. For a rule-based policy set the following parameters: *MetricName*, *ComparisonOperator*, *Threshold*, *EvaluationPeriods*, *ScalingAdjustmentType*, and *ScalingAdjustment*.  
*Required*: No  
*Type*: String  
*Allowed values*: `RuleBased | TargetBased`  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`ScalingAdjustment`  <a name="cfn-gamelift-fleet-scalingpolicy-scalingadjustment"></a>
Amount of adjustment to make, based on the scaling adjustment type.  
*Required*: No  
*Type*: Integer  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`ScalingAdjustmentType`  <a name="cfn-gamelift-fleet-scalingpolicy-scalingadjustmenttype"></a>
The type of adjustment to make to a fleet's instance count.  
+ **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.
*Required*: No  
*Type*: String  
*Allowed values*: `ChangeInCapacity | ExactCapacity | PercentChangeInCapacity`  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Status`  <a name="cfn-gamelift-fleet-scalingpolicy-status"></a>
Current status of the scaling policy. The scaling policy can be in force only when in an `ACTIVE` status. Scaling policies can be suspended for individual fleets. If the policy is suspended for a fleet, the policy status does not change.  
+ **ACTIVE** -- The scaling policy can be used for auto-scaling a fleet.
+ **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.
*Required*: No  
*Type*: String  
*Allowed values*: `ACTIVE | UPDATE_REQUESTED | UPDATING | DELETE_REQUESTED | DELETING | DELETED | ERROR`  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`TargetConfiguration`  <a name="cfn-gamelift-fleet-scalingpolicy-targetconfiguration"></a>
An object that contains settings for a target-based scaling policy.  
*Required*: No  
*Type*: [TargetConfiguration](aws-properties-gamelift-fleet-targetconfiguration.md)  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Threshold`  <a name="cfn-gamelift-fleet-scalingpolicy-threshold"></a>
Metric value used to trigger a scaling event.  
*Required*: No  
*Type*: Number  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`UpdateStatus`  <a name="cfn-gamelift-fleet-scalingpolicy-updatestatus"></a>
The current status of the fleet's scaling policies in a requested fleet location. The status `PENDING_UPDATE` indicates that an update was requested for the fleet but has not yet been completed for the location.  
*Required*: No  
*Type*: String  
*Allowed values*: `PENDING_UPDATE`  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)