2.3 KiB
2.3 KiB
layout | page_title | sidebar_current | description |
---|---|---|---|
aws | AWS: aws_autoscaling_policy | docs-aws-resource-autoscaling-policy | Provides an AutoScaling Scaling Group resource. |
aws_autoscaling_policy
Provides an AutoScaling Scaling Policy resource.
~> NOTE: You may want to omit desired_capacity
attribute from attached aws_autoscaling_group
when using autoscaling policies. It's good practice to pick either
manual
or dynamic
(policy-based) scaling.
Example Usage
resource "aws_autoscaling_policy" "bat" {
name = "foobar3-terraform-test"
scaling_adjustment = 4
adjustment_type = "ChangeInCapacity"
cooldown = 300
autoscaling_group_name = "${aws_autoscaling_group.bar.name}"
}
resource "aws_autoscaling_group" "bar" {
availability_zones = ["us-east-1a"]
name = "foobar3-terraform-test"
max_size = 5
min_size = 2
health_check_grace_period = 300
health_check_type = "ELB"
force_delete = true
launch_configuration = "${aws_launch_configuration.foo.name}"
}
Argument Reference
The following arguments are supported:
name
- (Required) The name of the policy.autoscaling_group_name
- (Required) The name or ARN of the group.adjustment_type
- (Required) Specifies whether thescaling_adjustment
is an absolute number or a percentage of the current capacity. Valid values areChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
.scaling_adjustment
- (Required) 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.cooldown
- (Optional) The amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start.min_adjustment_step
- (Optional) Used withadjustment_type
with the valuePercentChangeInCapacity
, the scaling policy changes thedesired_capacity
of the Auto Scaling group by at least the number of instances specified in the value.
Attribute Reference
arn
- The ARN assigned by AWS to the scaling policy.