Target

class Target : KotlinCustomResource

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

NOTE: Scalable targets created before 2023-03-20 may not have an assigned arn. These resource cannot use tags or participate in default_tags. To prevent pulumi preview showing differences that can never be reconciled, use the lifecycle.ignore_changes meta-argument. See the example below. 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 aws.iam.ServiceLinkedRole resource.

Example Usage

DynamoDB Table Autoscaling

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.appautoscaling.Target;
import com.pulumi.aws.appautoscaling.TargetArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var dynamodbTableReadTarget = new Target("dynamodbTableReadTarget", TargetArgs.builder()
.maxCapacity(100)
.minCapacity(5)
.resourceId(String.format("table/%s", aws_dynamodb_table.example().name()))
.scalableDimension("dynamodb:table:ReadCapacityUnits")
.serviceNamespace("dynamodb")
.build());
}
}

DynamoDB Index Autoscaling

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.appautoscaling.Target;
import com.pulumi.aws.appautoscaling.TargetArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var dynamodbIndexReadTarget = new Target("dynamodbIndexReadTarget", TargetArgs.builder()
.maxCapacity(100)
.minCapacity(5)
.resourceId(String.format("table/%s/index/%s", aws_dynamodb_table.example().name(),var_.index_name()))
.scalableDimension("dynamodb:index:ReadCapacityUnits")
.serviceNamespace("dynamodb")
.build());
}
}

ECS Service Autoscaling

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.appautoscaling.Target;
import com.pulumi.aws.appautoscaling.TargetArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var ecsTarget = new Target("ecsTarget", TargetArgs.builder()
.maxCapacity(4)
.minCapacity(1)
.resourceId(String.format("service/%s/%s", aws_ecs_cluster.example().name(),aws_ecs_service.example().name()))
.scalableDimension("ecs:service:DesiredCount")
.serviceNamespace("ecs")
.build());
}
}

Aurora Read Replica Autoscaling

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.appautoscaling.Target;
import com.pulumi.aws.appautoscaling.TargetArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var replicas = new Target("replicas", TargetArgs.builder()
.maxCapacity(15)
.minCapacity(1)
.resourceId(String.format("cluster:%s", aws_rds_cluster.example().id()))
.scalableDimension("rds:cluster:ReadReplicaCount")
.serviceNamespace("rds")
.build());
}
}

Suppressing tags_all Differences For Older Resources

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.appautoscaling.Target;
import com.pulumi.aws.appautoscaling.TargetArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var ecsTarget = new Target("ecsTarget", TargetArgs.builder()
.maxCapacity(4)
.minCapacity(1)
.resourceId(String.format("service/%s/%s", aws_ecs_cluster.example().name(),aws_ecs_service.example().name()))
.scalableDimension("ecs:service:DesiredCount")
.serviceNamespace("ecs")
.build());
}
}

MSK / Kafka Autoscaling

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.appautoscaling.Target;
import com.pulumi.aws.appautoscaling.TargetArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var mskTarget = new Target("mskTarget", TargetArgs.builder()
.maxCapacity(8)
.minCapacity(1)
.resourceId(aws_msk_cluster.example().arn())
.scalableDimension("kafka:broker-storage:VolumeSize")
.serviceNamespace("kafka")
.build());
}
}

Import

Application AutoScaling Target can be imported using the service-namespace , resource-id and scalable-dimension separated by /.

$ pulumi import aws:appautoscaling/target:Target test-target service-namespace/resource-id/scalable-dimension

Properties

Link copied to clipboard
val arn: Output<String>

The ARN of the scalable target.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val maxCapacity: Output<Int>

Max capacity of the scalable target.

Link copied to clipboard
val minCapacity: Output<Int>

Min capacity of the scalable target.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val resourceId: Output<String>

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

Link copied to clipboard
val roleArn: Output<String>

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.

Link copied to clipboard

Scalable dimension of the scalable target. Documentation can be found in the ScalableDimension parameter at: AWS Application Auto Scaling API Reference

Link copied to clipboard

AWS service namespace of the scalable target. Documentation can be found in the ServiceNamespace parameter at: AWS Application Auto Scaling API Reference

Link copied to clipboard
val tags: Output<Map<String, String>>?

Map of tags to assign to the scalable target. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val tagsAll: Output<Map<String, String>>

Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Link copied to clipboard
val urn: Output<String>