aws_appautoscaling_target
Provides an Application AutoScaling ScalableTarget resource. To manage policies which get attached to the target, see the aws_appautoscaling_policy
resource.
Example Usage
DynamoDB Table Autoscaling
resource "aws_appautoscaling_target" "dynamodb_table_read_target" { max_capacity = 100 min_capacity = 5 resource_id = "table/${aws_dynamodb_table.example.name}" role_arn = "${data.aws_iam_role.DynamoDBAutoscaleRole.arn}" scalable_dimension = "dynamodb:table:ReadCapacityUnits" service_namespace = "dynamodb" }
DynamoDB Index Autoscaling
resource "aws_appautoscaling_target" "dynamodb_index_read_target" { max_capacity = 100 min_capacity = 5 resource_id = "table/${aws_dynamodb_table.example.name}/index/${var.index_name}" role_arn = "${data.aws_iam_role.DynamoDBAutoscaleRole.arn}" scalable_dimension = "dynamodb:index:ReadCapacityUnits" service_namespace = "dynamodb" }
ECS Service Autoscaling
resource "aws_appautoscaling_target" "ecs_target" { max_capacity = 4 min_capacity = 1 resource_id = "service/${aws_ecs_cluster.example.name}/${aws_ecs_service.example.name}" role_arn = "${var.ecs_iam_role}" scalable_dimension = "ecs:service:DesiredCount" service_namespace = "ecs" }
Aurora Read Replica Autoscaling
resource "aws_appautoscaling_target" "replicas" { service_namespace = "rds" scalable_dimension = "rds:cluster:ReadReplicaCount" resource_id = "cluster:${aws_rds_cluster.example.id}" min_capacity = 1 max_capacity = 15 }
Argument Reference
The following arguments are supported:
-
max_capacity
- (Required) The max capacity of the scalable target. -
min_capacity
- (Required) The min capacity of the scalable target. -
resource_id
- (Required) The resource type and unique identifier string for the resource associated with the scaling policy. Documentation can be found in theResourceId
parameter at: AWS Application Auto Scaling API Reference -
role_arn
- (Optional) The ARN of the IAM role that allows Application AutoScaling to modify your scalable target on your behalf. -
scalable_dimension
- (Required) The scalable dimension of the scalable target. Documentation can be found in theScalableDimension
parameter at: AWS Application Auto Scaling API Reference -
service_namespace
- (Required) The AWS service namespace of the scalable target. Documentation can be found in theServiceNamespace
parameter at: AWS Application Auto Scaling API Reference
© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/aws/r/appautoscaling_target.html