amazonka-gamelift-1.6.1: Amazon GameLift SDK.

Copyright(c) 2013-2018 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Network.AWS.GameLift.PutScalingPolicy

Contents

Description

Creates or updates a scaling policy for a fleet. Scaling policies are used to automatically scale a fleet's hosting capacity to meet player demand. An active scaling policy instructs Amazon GameLift to track a fleet metric and automatically change the fleet's capacity when a certain threshold is reached. There are two types of scaling policies: target-based and rule-based. Use a target-based policy to quickly and efficiently manage fleet scaling; this option is the most commonly used. Use rule-based policies when you need to exert fine-grained control over auto-scaling.

Fleets can have multiple scaling policies of each type in force at the same time; you can have one target-based policy, one or multiple rule-based scaling policies, or both. We recommend caution, however, because multiple auto-scaling policies can have unintended consequences.

You can temporarily suspend all scaling policies for a fleet by calling StopFleetActions with the fleet action AUTO_SCALING. To resume scaling policies, call StartFleetActions with the same fleet action. To stop just one scaling policy--or to permanently remove it, you must delete the policy with DeleteScalingPolicy .

Learn more about how to work with auto-scaling in Set Up Fleet Automatic Scaling .

Target-based policy

A target-based policy tracks a single metric: PercentAvailableGameSessions. This metric tells us how much of a fleet's hosting capacity is ready to host game sessions but is not currently in use. This is the fleet's buffer; it measures the additional player demand that the fleet could handle at current capacity. With a target-based policy, you set your ideal buffer size and leave it to Amazon GameLift to take whatever action is needed to maintain that target.

For example, you might choose to maintain a 10% buffer for a fleet that has the capacity to host 100 simultaneous game sessions. This policy tells Amazon GameLift to take action whenever the fleet's available capacity falls below or rises above 10 game sessions. Amazon GameLift will start new instances or stop unused instances in order to return to the 10% buffer.

To create or update a target-based policy, specify a fleet ID and name, and set the policy type to TargetBased. Specify the metric to track (PercentAvailableGameSessions) and reference a TargetConfiguration object with your desired buffer value. Exclude all other parameters. On a successful request, the policy name is returned. The scaling policy is automatically in force as soon as it's successfully created. If the fleet's auto-scaling actions are temporarily suspended, the new policy will be in force once the fleet actions are restarted.

Rule-based policy

A rule-based policy tracks specified fleet metric, sets a threshold value, and specifies the type of action to initiate when triggered. With a rule-based policy, you can select from several available fleet metrics. Each policy specifies whether to scale up or scale down (and by how much), so you need one policy for each type of action.

For example, a policy may make the following statement: "If the percentage of idle instances is greater than 20% for more than 15 minutes, then reduce the fleet capacity by 10%."

A policy's rule statement has the following structure:

If [MetricName] is [ComparisonOperator] [Threshold] for [EvaluationPeriods] minutes, then [ScalingAdjustmentType] to/by [ScalingAdjustment] .

To implement the example, the rule statement would look like this:

If [PercentIdleInstances] is [GreaterThanThreshold] [20] for [15] minutes, then [PercentChangeInCapacity] to/by [10] .

To create or update a scaling policy, specify a unique combination of name and fleet ID, and set the policy type to RuleBased. Specify the parameter values for a policy rule statement. On a successful request, the policy name is returned. Scaling policies are automatically in force as soon as they're successfully created. If the fleet's auto-scaling actions are temporarily suspended, the new policy will be in force once the fleet actions are restarted.

Operations related to fleet capacity scaling include:

  • DescribeFleetCapacity
  • UpdateFleetCapacity
  • DescribeEC2InstanceLimits
  • Manage scaling policies:
  • PutScalingPolicy (auto-scaling)
  • DescribeScalingPolicies (auto-scaling)
  • DeleteScalingPolicy (auto-scaling)
  • Manage fleet actions:
  • StartFleetActions
  • StopFleetActions
Synopsis

Creating a Request

putScalingPolicy Source #

Creates a value of PutScalingPolicy with the minimum fields required to make a request.

Use one of the following lenses to modify other fields as desired:

  • pspScalingAdjustmentType - 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%.
  • pspEvaluationPeriods - Length of time (in minutes) the metric must be at or beyond the threshold before a scaling event is triggered.
  • pspPolicyType - 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 .
  • pspComparisonOperator - Comparison operator to use when measuring the metric against the threshold value.
  • pspThreshold - Metric value used to trigger a scaling event.
  • pspScalingAdjustment - Amount of adjustment to make, based on the scaling adjustment type.
  • pspTargetConfiguration - Object that contains settings for a target-based scaling policy.
  • pspName - 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.
  • pspFleetId - Unique identifier for a fleet to apply this policy to. The fleet cannot be in any of the following statuses: ERROR or DELETING.
  • pspMetricName - Name of the Amazon GameLift-defined metric that is used to trigger a scaling adjustment. For detailed descriptions of fleet metrics, see Monitor Amazon GameLift with Amazon CloudWatch . * 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.

data PutScalingPolicy Source #

Represents the input for a request action.

See: putScalingPolicy smart constructor.

Instances
Eq PutScalingPolicy Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

Data PutScalingPolicy Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PutScalingPolicy -> c PutScalingPolicy #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PutScalingPolicy #

toConstr :: PutScalingPolicy -> Constr #

dataTypeOf :: PutScalingPolicy -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PutScalingPolicy) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PutScalingPolicy) #

gmapT :: (forall b. Data b => b -> b) -> PutScalingPolicy -> PutScalingPolicy #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PutScalingPolicy -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PutScalingPolicy -> r #

gmapQ :: (forall d. Data d => d -> u) -> PutScalingPolicy -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> PutScalingPolicy -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> PutScalingPolicy -> m PutScalingPolicy #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PutScalingPolicy -> m PutScalingPolicy #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PutScalingPolicy -> m PutScalingPolicy #

Read PutScalingPolicy Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

Show PutScalingPolicy Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

Generic PutScalingPolicy Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

Associated Types

type Rep PutScalingPolicy :: Type -> Type #

Hashable PutScalingPolicy Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

ToJSON PutScalingPolicy Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

AWSRequest PutScalingPolicy Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

Associated Types

type Rs PutScalingPolicy :: Type #

ToHeaders PutScalingPolicy Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

ToPath PutScalingPolicy Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

ToQuery PutScalingPolicy Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

NFData PutScalingPolicy Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

Methods

rnf :: PutScalingPolicy -> () #

type Rep PutScalingPolicy Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

type Rs PutScalingPolicy Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

Request Lenses

pspScalingAdjustmentType :: Lens' PutScalingPolicy (Maybe ScalingAdjustmentType) Source #

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%.

pspEvaluationPeriods :: Lens' PutScalingPolicy (Maybe Natural) Source #

Length of time (in minutes) the metric must be at or beyond the threshold before a scaling event is triggered.

pspPolicyType :: Lens' PutScalingPolicy (Maybe PolicyType) Source #

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 .

pspComparisonOperator :: Lens' PutScalingPolicy (Maybe ComparisonOperatorType) Source #

Comparison operator to use when measuring the metric against the threshold value.

pspThreshold :: Lens' PutScalingPolicy (Maybe Double) Source #

Metric value used to trigger a scaling event.

pspScalingAdjustment :: Lens' PutScalingPolicy (Maybe Int) Source #

Amount of adjustment to make, based on the scaling adjustment type.

pspTargetConfiguration :: Lens' PutScalingPolicy (Maybe TargetConfiguration) Source #

Object that contains settings for a target-based scaling policy.

pspName :: Lens' PutScalingPolicy Text Source #

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.

pspFleetId :: Lens' PutScalingPolicy Text Source #

Unique identifier for a fleet to apply this policy to. The fleet cannot be in any of the following statuses: ERROR or DELETING.

pspMetricName :: Lens' PutScalingPolicy MetricName Source #

Name of the Amazon GameLift-defined metric that is used to trigger a scaling adjustment. For detailed descriptions of fleet metrics, see Monitor Amazon GameLift with Amazon CloudWatch . * 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.

Destructuring the Response

putScalingPolicyResponse Source #

Creates a value of PutScalingPolicyResponse with the minimum fields required to make a request.

Use one of the following lenses to modify other fields as desired:

  • psprsName - Descriptive label that is associated with a scaling policy. Policy names do not need to be unique.
  • psprsResponseStatus - -- | The response status code.

data PutScalingPolicyResponse Source #

Represents the returned data in response to a request action.

See: putScalingPolicyResponse smart constructor.

Instances
Eq PutScalingPolicyResponse Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

Data PutScalingPolicyResponse Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PutScalingPolicyResponse -> c PutScalingPolicyResponse #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PutScalingPolicyResponse #

toConstr :: PutScalingPolicyResponse -> Constr #

dataTypeOf :: PutScalingPolicyResponse -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PutScalingPolicyResponse) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PutScalingPolicyResponse) #

gmapT :: (forall b. Data b => b -> b) -> PutScalingPolicyResponse -> PutScalingPolicyResponse #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PutScalingPolicyResponse -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PutScalingPolicyResponse -> r #

gmapQ :: (forall d. Data d => d -> u) -> PutScalingPolicyResponse -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> PutScalingPolicyResponse -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> PutScalingPolicyResponse -> m PutScalingPolicyResponse #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PutScalingPolicyResponse -> m PutScalingPolicyResponse #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PutScalingPolicyResponse -> m PutScalingPolicyResponse #

Read PutScalingPolicyResponse Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

Show PutScalingPolicyResponse Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

Generic PutScalingPolicyResponse Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

Associated Types

type Rep PutScalingPolicyResponse :: Type -> Type #

NFData PutScalingPolicyResponse Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

type Rep PutScalingPolicyResponse Source # 
Instance details

Defined in Network.AWS.GameLift.PutScalingPolicy

type Rep PutScalingPolicyResponse = D1 (MetaData "PutScalingPolicyResponse" "Network.AWS.GameLift.PutScalingPolicy" "amazonka-gamelift-1.6.1-GajLKSxsevT2faX837q2Xl" False) (C1 (MetaCons "PutScalingPolicyResponse'" PrefixI True) (S1 (MetaSel (Just "_psprsName") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Text)) :*: S1 (MetaSel (Just "_psprsResponseStatus") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Int)))

Response Lenses

psprsName :: Lens' PutScalingPolicyResponse (Maybe Text) Source #

Descriptive label that is associated with a scaling policy. Policy names do not need to be unique.