github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/aws/r/autoscaling_policy.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_autoscaling_policy"
     4  sidebar_current: "docs-aws-resource-autoscaling-policy"
     5  description: |-
     6    Provides an AutoScaling Scaling Group resource.
     7  ---
     8  
     9  # aws\_autoscaling\_policy
    10  
    11  Provides an AutoScaling Scaling Policy resource.
    12  
    13  ~> **NOTE:** You may want to omit `desired_capacity` attribute from attached `aws_autoscaling_group`
    14  when using autoscaling policies. It's good practice to pick either
    15  [manual](https://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/as-manual-scaling.html)
    16  or [dynamic](https://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/as-scale-based-on-demand.html)
    17  (policy-based) scaling.
    18  
    19  ## Example Usage
    20  
    21  ```hcl
    22  resource "aws_autoscaling_policy" "bat" {
    23    name                   = "foobar3-terraform-test"
    24    scaling_adjustment     = 4
    25    adjustment_type        = "ChangeInCapacity"
    26    cooldown               = 300
    27    autoscaling_group_name = "${aws_autoscaling_group.bar.name}"
    28  }
    29  
    30  resource "aws_autoscaling_group" "bar" {
    31    availability_zones        = ["us-east-1a"]
    32    name                      = "foobar3-terraform-test"
    33    max_size                  = 5
    34    min_size                  = 2
    35    health_check_grace_period = 300
    36    health_check_type         = "ELB"
    37    force_delete              = true
    38    launch_configuration      = "${aws_launch_configuration.foo.name}"
    39  }
    40  ```
    41  
    42  ## Argument Reference
    43  
    44  The following arguments are supported:
    45  
    46  * `name` - (Required) The name of the policy.
    47  * `autoscaling_group_name` - (Required) The name or ARN of the group.
    48  * `adjustment_type` - (Required) Specifies whether the adjustment is an absolute number or a percentage of the current capacity. Valid values are `ChangeInCapacity`, `ExactCapacity`, and `PercentChangeInCapacity`.
    49  * `policy_type` - (Optional) The policy type, either "SimpleScaling" or "StepScaling". If this value isn't provided, AWS will default to "SimpleScaling."
    50  
    51  The following arguments are only available to "SimpleScaling" type policies:
    52  
    53  * `cooldown` - (Optional) The amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start.
    54  * `scaling_adjustment` - (Optional) The number of instances by which to scale. `adjustment_type` determines the interpretation of this number (e.g., as an absolute number or as a percentage of the existing Auto Scaling group size). A positive increment adds to the current capacity and a negative value removes from the current capacity.
    55  
    56  The following arguments are only available to "StepScaling" type policies:
    57  
    58  * `metric_aggregation_type` - (Optional) The aggregation type for the policy's metrics. Valid values are "Minimum", "Maximum", and "Average". Without a value, AWS will treat the aggregation type as "Average".
    59  * `estimated_instance_warmup` - (Optional) The estimated time, in seconds, until a newly launched instance will contribute CloudWatch metrics. Without a value, AWS will default to the group's specified cooldown period.
    60  * `step_adjustments` - (Optional) A set of adjustments that manage
    61  group scaling. These have the following structure:
    62  
    63  ```hcl
    64  step_adjustment {
    65    scaling_adjustment = -1
    66    metric_interval_lower_bound = 1.0
    67    metric_interval_upper_bound = 2.0
    68  }
    69  step_adjustment {
    70    scaling_adjustment = 1
    71    metric_interval_lower_bound = 2.0
    72    metric_interval_upper_bound = 3.0
    73  }
    74  ```
    75  
    76  The following fields are available in step adjustments:
    77  
    78  * `scaling_adjustment` - (Required) The number of members by which to
    79  scale, when the adjustment bounds are breached. A positive value scales
    80  up. A negative value scales down.
    81  * `metric_interval_lower_bound` - (Optional) The lower bound for the
    82  difference between the alarm threshold and the CloudWatch metric.
    83  Without a value, AWS will treat this bound as infinity.
    84  * `metric_interval_upper_bound` - (Optional) The upper bound for the
    85  difference between the alarm threshold and the CloudWatch metric.
    86  Without a value, AWS will treat this bound as infinity. The upper bound
    87  must be greater than the lower bound.
    88  
    89  The following arguments are supported for backwards compatibility but should not be used:
    90  
    91  * `min_adjustment_step` - (Optional) Use `min_adjustment_magnitude` instead.
    92  
    93  ## Attribute Reference
    94  * `arn` - The ARN assigned by AWS to the scaling policy.
    95  * `name` - The scaling policy's name.
    96  * `autoscaling_group_name` - The scaling policy's assigned autoscaling group.
    97  * `adjustment_type` - The scaling policy's adjustment type.
    98  * `policy_type` - The scaling policy's type.