github.com/adrian-bl/terraform@v0.7.0-rc2.0.20160705220747-de0a34fc3517/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 resource "aws_autoscaling_policy" "bat" { 22 name = "foobar3-terraform-test" 23 scaling_adjustment = 4 24 adjustment_type = "ChangeInCapacity" 25 cooldown = 300 26 autoscaling_group_name = "${aws_autoscaling_group.bar.name}" 27 } 28 29 resource "aws_autoscaling_group" "bar" { 30 availability_zones = ["us-east-1a"] 31 name = "foobar3-terraform-test" 32 max_size = 5 33 min_size = 2 34 health_check_grace_period = 300 35 health_check_type = "ELB" 36 force_delete = true 37 launch_configuration = "${aws_launch_configuration.foo.name}" 38 } 39 ``` 40 41 ## Argument Reference 42 43 The following arguments are supported: 44 45 * `name` - (Required) The name of the policy. 46 * `autoscaling_group_name` - (Required) The name or ARN of the group. 47 * `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`. 48 * `policy_type` - (Optional) The policy type, either "SimpleScaling" or "StepScaling". If this value isn't provided, AWS will default to "SimpleScaling." 49 50 The following arguments are only available to "SimpleScaling" type policies: 51 52 * `cooldown` - (Optional) The amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start. 53 * `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. 54 55 The following arguments are only available to "StepScaling" type policies: 56 57 * `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". 58 * `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. 59 * `step_adjustments` - (Optional) A set of adjustments that manage 60 group scaling. These have the following structure: 61 62 ``` 63 step_adjustment { 64 scaling_adjustment = -1 65 metric_interval_lower_bound = 1.0 66 metric_interval_upper_bound = 2.0 67 } 68 step_adjustment { 69 scaling_adjustment = 1 70 metric_interval_lower_bound = 2.0 71 metric_interval_upper_bound = 3.0 72 } 73 ``` 74 75 The following fields are available in step adjustments: 76 77 * `scaling_adjustment` - (Required) The number of members by which to 78 scale, when the adjustment bounds are breached. A positive value scales 79 up. A negative value scales down. 80 * `metric_interval_lower_bound` - (Optional) The lower bound for the 81 difference between the alarm threshold and the CloudWatch metric. 82 Without a value, AWS will treat this bound as infinity. 83 * `metric_interval_upper_bound` - (Optional) The upper bound for the 84 difference between the alarm threshold and the CloudWatch metric. 85 Without a value, AWS will treat this bound as infinity. The upper bound 86 must be greater than the lower bound. 87 88 The following arguments are supported for backwards compatibility but should not be used: 89 90 * `min_adjustment_step` - (Optional) Use `min_adjustment_magnitude` instead. 91 92 ## Attribute Reference 93 * `arn` - The ARN assigned by AWS to the scaling policy. 94 * `name` - The scaling policy's name. 95 * `autoscaling_group_name` - The scaling policy's assigned autoscaling group. 96 * `adjustment_type` - The scaling policy's adjustment type. 97 * `policy_type` - The scaling policy's type.