AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::AutoScaling::ScalingPolicy

Inherits:
Resources::Resource show all
Defined in:
(unknown)

Instance Attribute Summary collapse

Attributes inherited from Resources::Resource

#client, #identifiers

Instance Method Summary collapse

Methods inherited from Resources::Resource

add_data_attribute, add_identifier, #data, data_attributes, #data_loaded?, identifiers, #load, #wait_until

Methods included from Resources::OperationMethods

#add_batch_operation, #add_operation, #batch_operation, #batch_operation_names, #batch_operations, #operation, #operation_names, #operations

Constructor Details

#initialize(name, options = {}) ⇒ Object #initialize(options = {}) ⇒ Object

Overloads:

  • #initialize(name, options = {}) ⇒ Object

    Parameters:

    • name (String)

    Options Hash (options):

    • :client (Client)

      When `:client is not given, the options hash is used to construct a new Client object.

  • #initialize(options = {}) ⇒ Object

    Options Hash (options):

    • :name (required, String)
    • :client (Client)

      When `:client is not given, the options hash is used to construct a new Client object.

Instance Attribute Details

#adjustment_typeString (readonly)

Specifies how the scaling adjustment is interpreted (for example, an absolute number or a percentage). The valid values are ChangeInCapacity, ExactCapacity, and PercentChangeInCapacity.

Returns:

  • (String)

    Specifies how the scaling adjustment is interpreted (for example, an absolute number or a percentage).

#alarmsArray<Types::Alarm> (readonly)

The CloudWatch alarms related to the policy.

Returns:

  • (Array<Types::Alarm>)

    The CloudWatch alarms related to the policy.

#auto_scaling_group_nameString (readonly)

The name of the Auto Scaling group.

Returns:

  • (String)

    The name of the Auto Scaling group.

#cooldownInteger (readonly)

The duration of the policy\'s cooldown period, in seconds.

Returns:

  • (Integer)

    The duration of the policy\'s cooldown period, in seconds.

#enabledBoolean (readonly)

Indicates whether the policy is enabled (true) or disabled (false).

Returns:

  • (Boolean)

    Indicates whether the policy is enabled (true) or disabled (false).

#estimated_instance_warmupInteger (readonly)

The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.

Returns:

  • (Integer)

    The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.

#metric_aggregation_typeString (readonly)

The aggregation type for the CloudWatch metrics. The valid values are Minimum, Maximum, and Average.

Returns:

  • (String)

    The aggregation type for the CloudWatch metrics.

#min_adjustment_magnitudeInteger (readonly)

The minimum value to scale by when the adjustment type is PercentChangeInCapacity.

Returns:

  • (Integer)

    The minimum value to scale by when the adjustment type is PercentChangeInCapacity.

#min_adjustment_stepInteger (readonly)

Available for backward compatibility. Use MinAdjustmentMagnitude instead.

Returns:

  • (Integer)

    Available for backward compatibility.

#nameString (readonly)

Returns:

  • (String)

#policy_arnString (readonly)

The Amazon Resource Name (ARN) of the policy.

Returns:

  • (String)

    The Amazon Resource Name (ARN) of the policy.

#policy_nameString (readonly)

The name of the scaling policy.

Returns:

  • (String)

    The name of the scaling policy.

#policy_typeString (readonly)

One of the following policy types:

  • TargetTrackingScaling

  • StepScaling

  • SimpleScaling (default)

For more information, see Target tracking scaling policies and Step and simple scaling policies in the Amazon EC2 Auto Scaling User Guide.

Returns:

  • (String)

    One of the following policy types:.

#scaling_adjustmentInteger (readonly)

The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.

Returns:

  • (Integer)

    The amount by which to scale, based on the specified adjustment type.

#step_adjustmentsArray<Types::StepAdjustment> (readonly)

A set of adjustments that enable you to scale based on the size of the alarm breach.

Returns:

  • (Array<Types::StepAdjustment>)

    A set of adjustments that enable you to scale based on the size of the alarm breach.

#target_tracking_configurationTypes::TargetTrackingConfiguration (readonly)

A target tracking scaling policy.

Returns:

Instance Method Details

#delete(options = {}) ⇒ Struct

Deletes the specified scaling policy.

Deleting either a step scaling policy or a simple scaling policy deletes the underlying alarm action, but does not delete the alarm, even if it no longer has an associated action.

For more information, see Deleting a scaling policy in the Amazon EC2 Auto Scaling User Guide.

Examples:

Request syntax example with placeholder values


scalingpolicy.delete({
  auto_scaling_group_name: "ResourceName",
})

Options Hash (options):

  • :auto_scaling_group_name (String)

    The name of the Auto Scaling group.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#execute(options = {}) ⇒ Struct

Executes the specified policy. This can be useful for testing the design of your scaling policy.

Examples:

Request syntax example with placeholder values


scalingpolicy.execute({
  auto_scaling_group_name: "ResourceName",
  honor_cooldown: false,
  metric_value: 1.0,
  breach_threshold: 1.0,
})

Options Hash (options):

  • :auto_scaling_group_name (String)

    The name of the Auto Scaling group.

  • :honor_cooldown (Boolean)

    Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before executing the policy.

    Valid only if the policy type is SimpleScaling. For more information, see Scaling cooldowns for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.

  • :metric_value (Float)

    The metric value to compare to BreachThreshold. This enables you to execute a policy of type StepScaling and determine which step adjustment to use. For example, if the breach threshold is 50 and you want to use a step adjustment with a lower bound of 0 and an upper bound of 10, you can set the metric value to 59.

    If you specify a metric value that doesn\'t correspond to a step adjustment for the policy, the call returns an error.

    Required if the policy type is StepScaling and not supported otherwise.

  • :breach_threshold (Float)

    The breach threshold for the alarm.

    Required if the policy type is StepScaling and not supported otherwise.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#groupAutoScalingGroup?

Returns: