Module appautoscaling
This page documents the language specification for the aws package. If you're looking for help working with the inputs, outputs, or functions of aws resources in a Pulumi program, please see the resource documentation for examples and API reference.
This provider is a derived work of the Terraform Provider distributed under MPL 2.0. If you encounter a bug or missing feature, first check the
pulumi/pulumi-awsrepo; however, if that doesn’t turn up anything, please consult the sourceterraform-providers/terraform-provider-awsrepo.
Resources
Others
Resources
Resource Policy
class Policy extends CustomResourceProvides an Application AutoScaling Policy resource.
Example Usage
DynamoDB Table Autoscaling
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const dynamodbTableReadTarget = new aws.appautoscaling.Target("dynamodb_table_read_target", {
maxCapacity: 100,
minCapacity: 5,
resourceId: "table/tableName",
scalableDimension: "dynamodb:table:ReadCapacityUnits",
serviceNamespace: "dynamodb",
});
const dynamodbTableReadPolicy = new aws.appautoscaling.Policy("dynamodb_table_read_policy", {
policyType: "TargetTrackingScaling",
resourceId: dynamodbTableReadTarget.resourceId,
scalableDimension: dynamodbTableReadTarget.scalableDimension,
serviceNamespace: dynamodbTableReadTarget.serviceNamespace,
targetTrackingScalingPolicyConfiguration: {
predefinedMetricSpecification: {
predefinedMetricType: "DynamoDBReadCapacityUtilization",
},
targetValue: 70,
},
});ECS Service Autoscaling
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const ecsTarget = new aws.appautoscaling.Target("ecs_target", {
maxCapacity: 4,
minCapacity: 1,
resourceId: "service/clusterName/serviceName",
scalableDimension: "ecs:service:DesiredCount",
serviceNamespace: "ecs",
});
const ecsPolicy = new aws.appautoscaling.Policy("ecs_policy", {
policyType: "StepScaling",
resourceId: ecsTarget.resourceId,
scalableDimension: ecsTarget.scalableDimension,
serviceNamespace: ecsTarget.serviceNamespace,
stepScalingPolicyConfiguration: {
adjustmentType: "ChangeInCapacity",
cooldown: 60,
metricAggregationType: "Maximum",
stepAdjustments: [{
metricIntervalUpperBound: "0",
scalingAdjustment: -1,
}],
},
});Preserve desired count when updating an autoscaled ECS Service
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const ecsService = new aws.ecs.Service("ecs_service", {
cluster: "clusterName",
desiredCount: 2,
taskDefinition: "taskDefinitionFamily:1",
}, { ignoreChanges: ["desiredCount"] });Aurora Read Replica Autoscaling
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const replicasTarget = new aws.appautoscaling.Target("replicas", {
maxCapacity: 15,
minCapacity: 1,
resourceId: pulumi.interpolate`cluster:${aws_rds_cluster_example.id}`,
scalableDimension: "rds:cluster:ReadReplicaCount",
serviceNamespace: "rds",
});
const replicasPolicy = new aws.appautoscaling.Policy("replicas", {
policyType: "TargetTrackingScaling",
resourceId: replicasTarget.resourceId,
scalableDimension: replicasTarget.scalableDimension,
serviceNamespace: replicasTarget.serviceNamespace,
targetTrackingScalingPolicyConfiguration: {
predefinedMetricSpecification: {
predefinedMetricType: "RDSReaderAverageCPUUtilization",
},
scaleInCooldown: 300,
scaleOutCooldown: 300,
targetValue: 75,
},
});constructor
new Policy(name: string, args: PolicyArgs, opts?: pulumi.CustomResourceOptions)Create a Policy resource with the given unique name, arguments, and options.
nameThe unique name of the resource.argsThe arguments to use to populate this resource's properties.optsA bag of options that control this resource's behavior.
method get
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: PolicyState, opts?: pulumi.CustomResourceOptions): PolicyGet an existing Policy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
method getProvider
getProvider(moduleMember: string): ProviderResource | undefinedmethod isInstance
public static isInstance(obj: any): obj is PolicyReturns true if the given object is an instance of Policy. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
property arn
public arn: pulumi.Output<string>;The ARN assigned by AWS to the scaling policy.
property id
id: Output<ID>;id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.
property name
public name: pulumi.Output<string>;The name of the policy.
property policyType
public policyType: pulumi.Output<string | undefined>;The policy type. Valid values are StepScaling and TargetTrackingScaling. Defaults to StepScaling. Certain services only support only one policy type. For more information see the Target Tracking Scaling Policies and Step Scaling Policies documentation.
property resourceId
public resourceId: pulumi.Output<string>;The 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
property scalableDimension
public scalableDimension: pulumi.Output<string>;The scalable dimension of the scalable target. Documentation can be found in the ScalableDimension parameter at: AWS Application Auto Scaling API Reference
property serviceNamespace
public serviceNamespace: pulumi.Output<string>;The AWS service namespace of the scalable target. Documentation can be found in the ServiceNamespace parameter at: AWS Application Auto Scaling API Reference
property stepScalingPolicyConfiguration
public stepScalingPolicyConfiguration: pulumi.Output<PolicyStepScalingPolicyConfiguration | undefined>;Step scaling policy configuration, requires policyType = "StepScaling" (default). See supported fields below.
property targetTrackingScalingPolicyConfiguration
public targetTrackingScalingPolicyConfiguration: pulumi.Output<PolicyTargetTrackingScalingPolicyConfiguration | undefined>;A target tracking policy, requires policyType = "TargetTrackingScaling". See supported fields below.
property urn
urn: Output<URN>;urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
Resource ScheduledAction
class ScheduledAction extends CustomResourceProvides an Application AutoScaling ScheduledAction resource.
Example Usage
DynamoDB Table Autoscaling
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const dynamodbTarget = new aws.appautoscaling.Target("dynamodb", {
maxCapacity: 100,
minCapacity: 5,
resourceId: "table/tableName",
scalableDimension: "dynamodb:table:ReadCapacityUnits",
serviceNamespace: "dynamodb",
});
const dynamodbScheduledAction = new aws.appautoscaling.ScheduledAction("dynamodb", {
resourceId: dynamodbTarget.resourceId,
scalableDimension: dynamodbTarget.scalableDimension,
scalableTargetAction: {
maxCapacity: 200,
minCapacity: 1,
},
schedule: "at(2006-01-02T15:04:05)",
serviceNamespace: dynamodbTarget.serviceNamespace,
});ECS Service Autoscaling
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const ecsTarget = new aws.appautoscaling.Target("ecs", {
maxCapacity: 4,
minCapacity: 1,
resourceId: "service/clusterName/serviceName",
scalableDimension: "ecs:service:DesiredCount",
serviceNamespace: "ecs",
});
const ecsScheduledAction = new aws.appautoscaling.ScheduledAction("ecs", {
resourceId: ecsTarget.resourceId,
scalableDimension: ecsTarget.scalableDimension,
scalableTargetAction: {
maxCapacity: 10,
minCapacity: 1,
},
schedule: "at(2006-01-02T15:04:05)",
serviceNamespace: ecsTarget.serviceNamespace,
});constructor
new ScheduledAction(name: string, args: ScheduledActionArgs, opts?: pulumi.CustomResourceOptions)Create a ScheduledAction resource with the given unique name, arguments, and options.
nameThe unique name of the resource.argsThe arguments to use to populate this resource's properties.optsA bag of options that control this resource's behavior.
method get
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: ScheduledActionState, opts?: pulumi.CustomResourceOptions): ScheduledActionGet an existing ScheduledAction resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
method getProvider
getProvider(moduleMember: string): ProviderResource | undefinedmethod isInstance
public static isInstance(obj: any): obj is ScheduledActionReturns true if the given object is an instance of ScheduledAction. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
property arn
public arn: pulumi.Output<string>;The Amazon Resource Name (ARN) of the scheduled action.
property endTime
public endTime: pulumi.Output<string | undefined>;The date and time for the scheduled action to end. Specify the following format: 2006-01-02T15:04:05Z
property id
id: Output<ID>;id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.
property name
public name: pulumi.Output<string>;The name of the scheduled action.
property resourceId
public resourceId: pulumi.Output<string>;The identifier of the resource associated with the scheduled action. Documentation can be found in the parameter at: AWS Application Auto Scaling API Reference
property scalableDimension
public scalableDimension: pulumi.Output<string | undefined>;The scalable dimension. Documentation can be found in the parameter at: AWS Application Auto Scaling API Reference Example: ecs:service:DesiredCount
property scalableTargetAction
public scalableTargetAction: pulumi.Output<ScheduledActionScalableTargetAction | undefined>;The new minimum and maximum capacity. You can set both values or just one. See below
property schedule
public schedule: pulumi.Output<string | undefined>;The schedule for this action. The following formats are supported: At expressions - at(yyyy-mm-ddThh:mm:ss), Rate expressions - rate(valueunit), Cron expressions - cron(fields). In UTC. Documentation can be found in the parameter at: AWS Application Auto Scaling API Reference
property serviceNamespace
public serviceNamespace: pulumi.Output<string>;The namespace of the AWS service. Documentation can be found in the parameter at: AWS Application Auto Scaling API Reference Example: ecs
property startTime
public startTime: pulumi.Output<string | undefined>;The date and time for the scheduled action to start. Specify the following format: 2006-01-02T15:04:05Z
property urn
urn: Output<URN>;urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
Resource Target
class Target extends CustomResourceProvides an Application AutoScaling ScalableTarget resource. To manage policies which get attached to the target, see the aws.appautoscaling.Policy 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
aws.iam.ServiceLinkedRoleresource.
Example Usage
DynamoDB Table Autoscaling
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const dynamodbTableReadTarget = new aws.appautoscaling.Target("dynamodb_table_read_target", {
maxCapacity: 100,
minCapacity: 5,
resourceId: pulumi.interpolate`table/${aws_dynamodb_table_example.name}`,
scalableDimension: "dynamodb:table:ReadCapacityUnits",
serviceNamespace: "dynamodb",
});DynamoDB Index Autoscaling
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const dynamodbIndexReadTarget = new aws.appautoscaling.Target("dynamodb_index_read_target", {
maxCapacity: 100,
minCapacity: 5,
resourceId: pulumi.interpolate`table/${aws_dynamodb_table_example.name}/index/${var_index_name}`,
scalableDimension: "dynamodb:index:ReadCapacityUnits",
serviceNamespace: "dynamodb",
});ECS Service Autoscaling
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const ecsTarget = new aws.appautoscaling.Target("ecs_target", {
maxCapacity: 4,
minCapacity: 1,
resourceId: pulumi.interpolate`service/${aws_ecs_cluster_example.name}/${aws_ecs_service_example.name}`,
scalableDimension: "ecs:service:DesiredCount",
serviceNamespace: "ecs",
});Aurora Read Replica Autoscaling
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const replicas = new aws.appautoscaling.Target("replicas", {
maxCapacity: 15,
minCapacity: 1,
resourceId: pulumi.interpolate`cluster:${aws_rds_cluster_example.id}`,
scalableDimension: "rds:cluster:ReadReplicaCount",
serviceNamespace: "rds",
});constructor
new Target(name: string, args: TargetArgs, opts?: pulumi.CustomResourceOptions)Create a Target resource with the given unique name, arguments, and options.
nameThe unique name of the resource.argsThe arguments to use to populate this resource's properties.optsA bag of options that control this resource's behavior.
method get
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: TargetState, opts?: pulumi.CustomResourceOptions): TargetGet an existing Target resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
method getProvider
getProvider(moduleMember: string): ProviderResource | undefinedmethod isInstance
public static isInstance(obj: any): obj is TargetReturns true if the given object is an instance of Target. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
property id
id: Output<ID>;id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.
property maxCapacity
public maxCapacity: pulumi.Output<number>;The max capacity of the scalable target.
property minCapacity
public minCapacity: pulumi.Output<number>;The min capacity of the scalable target.
property resourceId
public resourceId: pulumi.Output<string>;The 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
property roleArn
public roleArn: pulumi.Output<string>;The 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.
property scalableDimension
public scalableDimension: pulumi.Output<string>;The scalable dimension of the scalable target. Documentation can be found in the ScalableDimension parameter at: AWS Application Auto Scaling API Reference
property serviceNamespace
public serviceNamespace: pulumi.Output<string>;The AWS service namespace of the scalable target. Documentation can be found in the ServiceNamespace parameter at: AWS Application Auto Scaling API Reference
property urn
urn: Output<URN>;urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
Others
interface PolicyArgs
interface PolicyArgsThe set of arguments for constructing a Policy resource.
property name
name?: pulumi.Input<string>;The name of the policy.
property policyType
policyType?: pulumi.Input<string>;The policy type. Valid values are StepScaling and TargetTrackingScaling. Defaults to StepScaling. Certain services only support only one policy type. For more information see the Target Tracking Scaling Policies and Step Scaling Policies documentation.
property resourceId
resourceId: pulumi.Input<string>;The 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
property scalableDimension
scalableDimension: pulumi.Input<string>;The scalable dimension of the scalable target. Documentation can be found in the ScalableDimension parameter at: AWS Application Auto Scaling API Reference
property serviceNamespace
serviceNamespace: pulumi.Input<string>;The AWS service namespace of the scalable target. Documentation can be found in the ServiceNamespace parameter at: AWS Application Auto Scaling API Reference
property stepScalingPolicyConfiguration
stepScalingPolicyConfiguration?: pulumi.Input<PolicyStepScalingPolicyConfiguration>;Step scaling policy configuration, requires policyType = "StepScaling" (default). See supported fields below.
property targetTrackingScalingPolicyConfiguration
targetTrackingScalingPolicyConfiguration?: pulumi.Input<PolicyTargetTrackingScalingPolicyConfiguration>;A target tracking policy, requires policyType = "TargetTrackingScaling". See supported fields below.
interface PolicyState
interface PolicyStateInput properties used for looking up and filtering Policy resources.
property arn
arn?: pulumi.Input<string>;The ARN assigned by AWS to the scaling policy.
property name
name?: pulumi.Input<string>;The name of the policy.
property policyType
policyType?: pulumi.Input<string>;The policy type. Valid values are StepScaling and TargetTrackingScaling. Defaults to StepScaling. Certain services only support only one policy type. For more information see the Target Tracking Scaling Policies and Step Scaling Policies documentation.
property resourceId
resourceId?: pulumi.Input<string>;The 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
property scalableDimension
scalableDimension?: pulumi.Input<string>;The scalable dimension of the scalable target. Documentation can be found in the ScalableDimension parameter at: AWS Application Auto Scaling API Reference
property serviceNamespace
serviceNamespace?: pulumi.Input<string>;The AWS service namespace of the scalable target. Documentation can be found in the ServiceNamespace parameter at: AWS Application Auto Scaling API Reference
property stepScalingPolicyConfiguration
stepScalingPolicyConfiguration?: pulumi.Input<PolicyStepScalingPolicyConfiguration>;Step scaling policy configuration, requires policyType = "StepScaling" (default). See supported fields below.
property targetTrackingScalingPolicyConfiguration
targetTrackingScalingPolicyConfiguration?: pulumi.Input<PolicyTargetTrackingScalingPolicyConfiguration>;A target tracking policy, requires policyType = "TargetTrackingScaling". See supported fields below.
interface ScheduledActionArgs
interface ScheduledActionArgsThe set of arguments for constructing a ScheduledAction resource.
property endTime
endTime?: pulumi.Input<string>;The date and time for the scheduled action to end. Specify the following format: 2006-01-02T15:04:05Z
property name
name?: pulumi.Input<string>;The name of the scheduled action.
property resourceId
resourceId: pulumi.Input<string>;The identifier of the resource associated with the scheduled action. Documentation can be found in the parameter at: AWS Application Auto Scaling API Reference
property scalableDimension
scalableDimension?: pulumi.Input<string>;The scalable dimension. Documentation can be found in the parameter at: AWS Application Auto Scaling API Reference Example: ecs:service:DesiredCount
property scalableTargetAction
scalableTargetAction?: pulumi.Input<ScheduledActionScalableTargetAction>;The new minimum and maximum capacity. You can set both values or just one. See below
property schedule
schedule?: pulumi.Input<string>;The schedule for this action. The following formats are supported: At expressions - at(yyyy-mm-ddThh:mm:ss), Rate expressions - rate(valueunit), Cron expressions - cron(fields). In UTC. Documentation can be found in the parameter at: AWS Application Auto Scaling API Reference
property serviceNamespace
serviceNamespace: pulumi.Input<string>;The namespace of the AWS service. Documentation can be found in the parameter at: AWS Application Auto Scaling API Reference Example: ecs
property startTime
startTime?: pulumi.Input<string>;The date and time for the scheduled action to start. Specify the following format: 2006-01-02T15:04:05Z
interface ScheduledActionState
interface ScheduledActionStateInput properties used for looking up and filtering ScheduledAction resources.
property arn
arn?: pulumi.Input<string>;The Amazon Resource Name (ARN) of the scheduled action.
property endTime
endTime?: pulumi.Input<string>;The date and time for the scheduled action to end. Specify the following format: 2006-01-02T15:04:05Z
property name
name?: pulumi.Input<string>;The name of the scheduled action.
property resourceId
resourceId?: pulumi.Input<string>;The identifier of the resource associated with the scheduled action. Documentation can be found in the parameter at: AWS Application Auto Scaling API Reference
property scalableDimension
scalableDimension?: pulumi.Input<string>;The scalable dimension. Documentation can be found in the parameter at: AWS Application Auto Scaling API Reference Example: ecs:service:DesiredCount
property scalableTargetAction
scalableTargetAction?: pulumi.Input<ScheduledActionScalableTargetAction>;The new minimum and maximum capacity. You can set both values or just one. See below
property schedule
schedule?: pulumi.Input<string>;The schedule for this action. The following formats are supported: At expressions - at(yyyy-mm-ddThh:mm:ss), Rate expressions - rate(valueunit), Cron expressions - cron(fields). In UTC. Documentation can be found in the parameter at: AWS Application Auto Scaling API Reference
property serviceNamespace
serviceNamespace?: pulumi.Input<string>;The namespace of the AWS service. Documentation can be found in the parameter at: AWS Application Auto Scaling API Reference Example: ecs
property startTime
startTime?: pulumi.Input<string>;The date and time for the scheduled action to start. Specify the following format: 2006-01-02T15:04:05Z
interface TargetArgs
interface TargetArgsThe set of arguments for constructing a Target resource.
property maxCapacity
maxCapacity: pulumi.Input<number>;The max capacity of the scalable target.
property minCapacity
minCapacity: pulumi.Input<number>;The min capacity of the scalable target.
property resourceId
resourceId: pulumi.Input<string>;The 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
property roleArn
roleArn?: pulumi.Input<string>;The 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.
property scalableDimension
scalableDimension: pulumi.Input<string>;The scalable dimension of the scalable target. Documentation can be found in the ScalableDimension parameter at: AWS Application Auto Scaling API Reference
property serviceNamespace
serviceNamespace: pulumi.Input<string>;The AWS service namespace of the scalable target. Documentation can be found in the ServiceNamespace parameter at: AWS Application Auto Scaling API Reference
interface TargetState
interface TargetStateInput properties used for looking up and filtering Target resources.
property maxCapacity
maxCapacity?: pulumi.Input<number>;The max capacity of the scalable target.
property minCapacity
minCapacity?: pulumi.Input<number>;The min capacity of the scalable target.
property resourceId
resourceId?: pulumi.Input<string>;The 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
property roleArn
roleArn?: pulumi.Input<string>;The 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.
property scalableDimension
scalableDimension?: pulumi.Input<string>;The scalable dimension of the scalable target. Documentation can be found in the ScalableDimension parameter at: AWS Application Auto Scaling API Reference
property serviceNamespace
serviceNamespace?: pulumi.Input<string>;The AWS service namespace of the scalable target. Documentation can be found in the ServiceNamespace parameter at: AWS Application Auto Scaling API Reference