Skip to content

Resource: awsAppautoscalingTarget

Provides an Application AutoScaling ScalableTarget resource. To manage policies which get attached to the target, see the awsAppautoscalingPolicy resource.

\~> NOTE: The Application Auto Scaling service automatically attempts to manage IAM Service-Linked Roles when registering certain service namespaces for the first time. To manually manage this role, see the awsIamServiceLinkedRole resource.

Example Usage

DynamoDB Table Autoscaling

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.appautoscalingTarget.AppautoscalingTarget(
  this,
  "dynamodb_table_read_target",
  {
    maxCapacity: 100,
    minCapacity: 5,
    resourceId: "table/${aws_dynamodb_table.example.name}",
    scalableDimension: "dynamodb:table:ReadCapacityUnits",
    serviceNamespace: "dynamodb",
  }
);

DynamoDB Index Autoscaling

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.appautoscalingTarget.AppautoscalingTarget(
  this,
  "dynamodb_index_read_target",
  {
    maxCapacity: 100,
    minCapacity: 5,
    resourceId:
      "table/${aws_dynamodb_table.example.name}/index/${var.index_name}",
    scalableDimension: "dynamodb:index:ReadCapacityUnits",
    serviceNamespace: "dynamodb",
  }
);

ECS Service Autoscaling

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.appautoscalingTarget.AppautoscalingTarget(this, "ecs_target", {
  maxCapacity: 4,
  minCapacity: 1,
  resourceId:
    "service/${aws_ecs_cluster.example.name}/${aws_ecs_service.example.name}",
  scalableDimension: "ecs:service:DesiredCount",
  serviceNamespace: "ecs",
});

Aurora Read Replica Autoscaling

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.appautoscalingTarget.AppautoscalingTarget(this, "replicas", {
  maxCapacity: 15,
  minCapacity: 1,
  resourceId: "cluster:${aws_rds_cluster.example.id}",
  scalableDimension: "rds:cluster:ReadReplicaCount",
  serviceNamespace: "rds",
});

Argument Reference

The following arguments are supported:

  • maxCapacity - (Required) Max capacity of the scalable target.
  • minCapacity - (Required) Min capacity of the scalable target.
  • resourceId - (Required) Resource type and unique identifier string for the resource associated with the scaling policy. Documentation can be found in the resourceId parameter at: AWS Application Auto Scaling API Reference
  • roleArn - (Optional) ARN of the IAM role that allows Application AutoScaling to modify your scalable target on your behalf. This defaults to an IAM Service-Linked Role for most services and custom IAM Roles are ignored by the API for those namespaces. See the AWS Application Auto Scaling documentation for more information about how this service interacts with IAM.
  • scalableDimension - (Required) Scalable dimension of the scalable target. Documentation can be found in the scalableDimension parameter at: AWS Application Auto Scaling API Reference
  • serviceNamespace - (Required) AWS service namespace of the scalable target. Documentation can be found in the serviceNamespace parameter at: AWS Application Auto Scaling API Reference

Attributes Reference

No additional attributes are exported.

Import

Application AutoScaling Target can be imported using the serviceNamespace , resourceId and scalableDimension separated by /.

$ terraform import aws_appautoscaling_target.test-target service-namespace/resource-id/scalable-dimension