Class Target


  • public class Target
    extends com.pulumi.resources.CustomResource
    Provides an Application Auto Scaling 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 `defaultTags`. 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](https://docs.aws.amazon.com/autoscaling/application/userguide/security_iam_service-with-iam.html#security_iam_service-with-iam-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.ArrayList;
     import java.util.Arrays;
     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", 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.ArrayList;
     import java.util.Arrays;
     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", example.name(),indexName))
                 .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.ArrayList;
     import java.util.Arrays;
     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", example.name(),exampleAwsEcsService.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.ArrayList;
     import java.util.Arrays;
     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()
                 .serviceNamespace("rds")
                 .scalableDimension("rds:cluster:ReadReplicaCount")
                 .resourceId(String.format("cluster:%s", example.id()))
                 .minCapacity(1)
                 .maxCapacity(15)
                 .build());
     
         }
     }
     
     
    ### Suppressing `tagsAll` 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 com.pulumi.resources.CustomResourceOptions;
     import java.util.ArrayList;
     import java.util.Arrays;
     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", example.name(),exampleAwsEcsService.name()))
                 .scalableDimension("ecs:service:DesiredCount")
                 .serviceNamespace("ecs")
                 .build(), CustomResourceOptions.builder()
                     .ignoreChanges(tagsAll)
                     .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.ArrayList;
     import java.util.Arrays;
     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()
                 .serviceNamespace("kafka")
                 .scalableDimension("kafka:broker-storage:VolumeSize")
                 .resourceId(example.arn())
                 .minCapacity(1)
                 .maxCapacity(8)
                 .build());
     
         }
     }
     
     
    ## Import ### Identity Schema #### Required * `resourceId` - (String) Resource type and unique identifier string for the resource associated with the scalable target. * `scalableDimension` - (String) Scalable dimension of the scalable target. * `serviceNamespace` - (String) AWS service namespace of the scalable target. #### Optional * `accountId` (String) AWS Account where this resource is managed. * `region` (String) Region where this resource is managed. Using `pulumi import`, import Application Auto Scaling Target using the `service-namespace` , `resource-id` and `scalable-dimension` separated by `/`. For example: ```sh $ pulumi import aws:appautoscaling/target:Target test-target service-namespace/resource-id/scalable-dimension ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Constructor Summary

      Constructors 
      Constructor Description
      Target​(java.lang.String name)  
      Target​(java.lang.String name, TargetArgs args)  
      Target​(java.lang.String name, TargetArgs args, com.pulumi.resources.CustomResourceOptions options)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.lang.String> arn()  
      static Target get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, TargetState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.lang.Integer> maxCapacity()  
      com.pulumi.core.Output<java.lang.Integer> minCapacity()  
      com.pulumi.core.Output<java.lang.String> region()  
      com.pulumi.core.Output<java.lang.String> resourceId()  
      com.pulumi.core.Output<java.lang.String> roleArn()  
      com.pulumi.core.Output<java.lang.String> scalableDimension()  
      com.pulumi.core.Output<java.lang.String> serviceNamespace()  
      com.pulumi.core.Output<TargetSuspendedState> suspendedState()  
      com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()  
      com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Target

        public Target​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • Target

        public Target​(java.lang.String name,
                      TargetArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • Target

        public Target​(java.lang.String name,
                      TargetArgs args,
                      @Nullable
                      com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • arn

        public com.pulumi.core.Output<java.lang.String> arn()
        Returns:
        ARN of the scalable target.
      • maxCapacity

        public com.pulumi.core.Output<java.lang.Integer> maxCapacity()
        Returns:
        Max capacity of the scalable target.
      • minCapacity

        public com.pulumi.core.Output<java.lang.Integer> minCapacity()
        Returns:
        Min capacity of the scalable target.
      • region

        public com.pulumi.core.Output<java.lang.String> region()
        Returns:
        Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
      • resourceId

        public com.pulumi.core.Output<java.lang.String> resourceId()
        Returns:
        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](https://docs.aws.amazon.com/autoscaling/application/APIReference/API_RegisterScalableTarget.html#API_RegisterScalableTarget_RequestParameters)
      • roleArn

        public com.pulumi.core.Output<java.lang.String> roleArn()
        Returns:
        ARN of the IAM role that allows Application Auto Scaling 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](https://docs.aws.amazon.com/autoscaling/application/userguide/security_iam_service-with-iam.html#security_iam_service-with-iam-roles) for more information about how this service interacts with IAM.
      • scalableDimension

        public com.pulumi.core.Output<java.lang.String> scalableDimension()
        Returns:
        Scalable dimension of the scalable target. Documentation can be found in the `ScalableDimension` parameter at: [AWS Application Auto Scaling API Reference](https://docs.aws.amazon.com/autoscaling/application/APIReference/API_RegisterScalableTarget.html#API_RegisterScalableTarget_RequestParameters)
      • serviceNamespace

        public com.pulumi.core.Output<java.lang.String> serviceNamespace()
        Returns:
        AWS service namespace of the scalable target. Documentation can be found in the `ServiceNamespace` parameter at: [AWS Application Auto Scaling API Reference](https://docs.aws.amazon.com/autoscaling/application/APIReference/API_RegisterScalableTarget.html#API_RegisterScalableTarget_RequestParameters)
      • suspendedState

        public com.pulumi.core.Output<TargetSuspendedState> suspendedState()
        Returns:
        Whether the scaling activities for a scalable target are in a suspended state.
      • tags

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()
        Returns:
        Map of tags to assign to the scalable target. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
      • tagsAll

        public com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()
        Returns:
        Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
      • get

        public static Target get​(java.lang.String name,
                                 com.pulumi.core.Output<java.lang.String> id,
                                 @Nullable
                                 TargetState state,
                                 @Nullable
                                 com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.