Module autoscaling

@pulumi/awsx > autoscaling

class AutoScalingGroup

extends ComponentResource

constructor

new AutoScalingGroup(name: string, args: AutoScalingGroupArgs, opts: pulumi.ComponentResourceOptions)

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

method registerOutputs

protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void

method scaleInSteps

public scaleInSteps(name: string, args: stepScaling.StepScalingPolicyArgs, opts?: pulumi.ComponentResourceOptions): StepScalingPolicy

Creates a [StepScalingPolicy] that increases or decreases the current capacity of this AutoScalingGroup based on a set of scaling adjustments, known as step adjustments. The adjustments vary based on the size of the alarm breach.

See [StepScalingPolicy] for more details.

method scaleOnSchedule

public scaleOnSchedule(name: string, args: ScheduleArgs, opts: pulumi.CustomResourceOptions): Schedule

method scaleToTrackAverageCPUUtilization

public scaleToTrackAverageCPUUtilization(name: string, args: targetTracking.TargetTrackingPolicyArgs, opts?: pulumi.ComponentResourceOptions): aws.autoscaling.Policy

Scales in response to the average CPU utilization of the [AutoScalingGroup].

method scaleToTrackAverageNetworkIn

public scaleToTrackAverageNetworkIn(name: string, args: targetTracking.TargetTrackingPolicyArgs, opts?: pulumi.ComponentResourceOptions): aws.autoscaling.Policy

Scales in response to the average number of bytes received on all network interfaces by the [AutoScalingGroup].

method scaleToTrackAverageNetworkOut

public scaleToTrackAverageNetworkOut(name: string, args: targetTracking.TargetTrackingPolicyArgs, opts?: pulumi.ComponentResourceOptions): aws.autoscaling.Policy

Scales in response to the average number of bytes sent out on all network interfaces by the [AutoScalingGroup].

method scaleToTrackMetric

public scaleToTrackMetric(name: string, args: targetTracking.CustomMetricTargetTrackingPolicyArgs, opts?: pulumi.ComponentResourceOptions): aws.autoscaling.Policy

With target tracking scaling policies, you select a scaling metric and set a target value. Amazon EC2 Auto Scaling creates and manages the CloudWatch alarms that trigger the scaling policy and calculates the scaling adjustment based on the metric and the target value. The scaling policy adds or removes capacity as required to keep the metric at, or close to, the specified target value. In addition to keeping the metric close to the target value, a target tracking scaling policy also adjusts to the changes in the metric due to a changing load pattern.

For example, you can use target tracking scaling to:

  • Configure a target tracking scaling policy to keep the average aggregate CPU utilization of your Auto Scaling group at 50 percent.

  • Configure a target tracking scaling policy to keep the request count per target of your Elastic Load Balancing target group at 1000 for your Auto Scaling group.

We recommend that you scale on Amazon EC2 instance metrics with a 1-minute frequency because that ensures a faster response to utilization changes. Scaling on metrics with a 5-minute frequency can result in slower response times and scaling on stale metric data. By default, Amazon EC2 instances are enabled for basic monitoring, which means metric data for instances is available at 5-minute intervals. You can enable detailed monitoring to get metric data for instances at 1-minute frequency. For more information, see Configure-Monitoring-for-Auto-Scaling-Instances.

See https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-target-tracking.html for more details.

method scaleToTrackRequestCountPerTarget

public scaleToTrackRequestCountPerTarget(name: string, args: targetTracking.ApplicationTargetGroupTrackingPolicyArgs, opts?: pulumi.ComponentResourceOptions): Policy

Scales in response to the number of requests completed per target in an [TargetGroup]. [AutoScalingGroup]. These [TargetGroup]s must have been provided to the [AutoScalingGroup] when constructed using [AutoScalingGroupArgs.targetGroups].

property group

public group: aws.autoscaling.Group;

Underlying [autoscaling.Group] that is created by cloudformation.

property launchConfiguration

public launchConfiguration: AutoScalingLaunchConfiguration;

The launch configuration for this auto scaling group.

property stack

public stack: aws.cloudformation.Stack;

The [cloudformation.Stack] that was used to create this [AutoScalingGroup]. [CloudFormation] is used here as the existing AWS apis for creating [AutoScalingGroup]s are not rich enough to express everything that can be configured through [CloudFormation] itself.

property targetGroups

public targetGroups: x.elasticloadbalancingv2.TargetGroup[];

Target groups this [AutoScalingGroup] is attached to. See https://docs.aws.amazon.com/autoscaling/ec2/userguide/attach-load-balancer-asg.html for more details.

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

property vpc

public vpc: x.ec2.Vpc;

class AutoScalingLaunchConfiguration

extends ComponentResource

constructor

new AutoScalingLaunchConfiguration(name: string, vpc: x.ec2.Vpc, args: AutoScalingLaunchConfigurationArgs, opts: pulumi.ComponentResourceOptions)

method createInstanceProfile

public static createInstanceProfile(name: string, assumeRolePolicy?: string | aws.iam.PolicyDocument, policyArns?: string[], opts?: pulumi.ComponentResourceOptions): InstanceProfile

Creates the [instanceProfile] for a [ClusterAutoScalingLaunchConfiguration] if not provided explicitly. If [assumeRolePolicy] is provided it will be used when creating the task, otherwise [defaultInstanceProfilePolicyDocument] will be used. If [policyArns] are provided, they will be used to create [RolePolicyAttachment]s for the Role. Otherwise, [defaultInstanceProfilePolicyARNs] will be used.

method defaultInstanceProfilePolicyARNs

public static defaultInstanceProfilePolicyARNs(): string[]

method defaultInstanceProfilePolicyDocument

public static defaultInstanceProfilePolicyDocument(): aws.iam.PolicyDocument

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

method registerOutputs

protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void

property id

public id: pulumi.Output<string>;

property instanceProfile

public instanceProfile: aws.iam.InstanceProfile;

property launchConfiguration

public launchConfiguration: aws.ec2.LaunchConfiguration;

property securityGroups

public securityGroups: x.ec2.SecurityGroup[];

property stackName

public stackName: pulumi.Output<string>;

Name to give the auto-scaling-group’s cloudformation stack name.

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

class StepScalingPolicy

extends ComponentResource

Step scaling policies increase or decrease the current capacity of your Auto Scaling group based on a set of scaling adjustments, known as step adjustments. The adjustments vary based on the size of the alarm breach.

For example, consider the following StepScaling description for an ASG that has both a current capacity and a desired capacity of 10. The current and desired capacity is maintained while the aggregated metric value is greater than 40 and less than 60.

 const policy = {
     // ... other values
     adjustmentType: "PercentChangeInCapacity",
     steps: {
         upper: [{ value: 60, adjustment: 10 }, { value: 70, adjustment: 30 }],
         lower: [{ value: 40, adjustment: -10 }, { value: 30, adjustment: -30 }]
     },
 };

If the metric value gets to 60, Application Auto Scaling increases the desired capacity of the group by 1, to 11. That’s based on the second step adjustment of the scale-out policy (add 10 percent of 10). After the new capacity is added, Application Auto Scaling increases the current capacity to 11. If the metric value rises to 70 even after this increase in capacity, Application Auto Scaling increases the target capacity by 3, to 14. That’s based on the third step adjustment of the scale-out policy (add 30 percent of 11, 3.3, rounded down to 3).

If the metric value gets to 40, Application Auto Scaling decreases the target capacity by 1, to 13, based on the second step adjustment of the scale-in policy (remove 10 percent of 14, 1.4, rounded down to 1). If the metric value falls to 30 even after this decrease in capacity, Application Auto Scaling decreases the target capacity by 3, to 10, based on the third step adjustment of the scale-in policy (remove 30 percent of 13, 3.9, rounded down to 3).

constructor

new StepScalingPolicy(name: string, group: AutoScalingGroup, args: StepScalingPolicyArgs, opts: pulumi.ComponentResourceOptions)

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

method registerOutputs

protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void

property lowerAlarm

public lowerAlarm: aws.cloudwatch.MetricAlarm | undefined;

Alarm that invokes [lowerPolicy] when the metric goes below the highest value of the lower range of steps.

property lowerPolicy

public lowerPolicy: aws.autoscaling.Policy | undefined;

Underlying [Policy] created to define the scaling strategy for the lower set of steps.

property upperAlarm

public upperAlarm: aws.cloudwatch.MetricAlarm | undefined;

Alarm that invokes [upperPolicy] when the metric goes above the lowest value of the upper range of steps.

property upperPolicy

public upperPolicy: aws.autoscaling.Policy | undefined;

Underlying [Policy] created to define the scaling strategy for the upper set of steps.

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

function convertLowerSteps

function convertSteps

function convertUpperSteps

function createCustomMetricPolicy

function createPolicy

function createPredefinedMetricPolicy

function cronExpression

cronExpression(a: ScheduleRecurrenceArgs): string

Creates an appropriate Cron format string that can be used as the [recurrence] property of [ScheduleArgs].

interface ApplicationTargetGroupTrackingPolicyArgs

extends TargetTrackingPolicyArgs

property disableScaleIn

disableScaleIn?: pulumi.Input<boolean>;

Indicates whether scaling in by the target tracking scaling policy is disabled. If scaling in is disabled, the target tracking scaling policy doesn’t remove instances from the Auto Scaling group. Otherwise, the target tracking scaling policy can remove instances from the Auto Scaling group. Defaults to [false] if unspecified.

property estimatedInstanceWarmup

estimatedInstanceWarmup?: pulumi.Input<number>;

The estimated time, in seconds, until a newly launched instance will contribute CloudWatch metrics. Without a value, AWS will default to the group’s specified cooldown period.

property targetGroup

targetGroup: x.elasticloadbalancingv2.ApplicationTargetGroup;

The target group to scale [AutoScalingGroup] in response to number of requests to. This must be a [TargetGroup] that the [AutoScalingGroup] was created with. These can be provided to the [AutoScalingGroup] using [AutoScalingGroupArgs.targetGroups].

property targetValue

targetValue: pulumi.Input<number>;

The target value for the metric.

interface AutoScalingGroupArgs

property disableRollback

disableRollback?: pulumi.Input<boolean>;

Set to true to disable rollback of the underlying aws.cloudformation.Stack if that Stack creation failed. Defaults to ‘false’. Conflicts with onFailure.

property launchConfiguration

launchConfiguration?: AutoScalingLaunchConfiguration;

The config to use when creating the auto scaling group.

[launchConfiguration] or [launchConfigurationArgs] can be provided. And, if either are provided will be used as the launch configuration for the auto scaling group.

If neither are provided, a default instance will be create by calling [cluster.createAutoScalingConfig()].

property launchConfigurationArgs

launchConfigurationArgs?: AutoScalingLaunchConfigurationArgs;

The config to use when creating the auto scaling group.

[launchConfiguration] or [launchConfigurationArgs] can be provided. And, if either are provided will be used as the launch configuration for the auto scaling group.

If neither are provided, a default instance will be create by calling [cluster.createAutoScalingConfig()].

property onFailure

onFailure?: pulumi.Input<“DO_NOTHING” | “ROLLBACK” | “DELETE”>;

Action to be taken if stack creation fails. This must be one of: DO_NOTHING, ROLLBACK, or DELETE. Conflicts with disableRollback.

property subnetIds

subnetIds?: pulumi.Input<string>[];

The subnets to use for the autoscaling group. If not provided, the private subnets of the vpc will be used.

property targetGroups

targetGroups?: x.elasticloadbalancingv2.TargetGroup[];

A list of target groups to associate with the Auto Scaling group. All target groups must have the “instance” [targetType].

property templateParameters

templateParameters?: pulumi.Input<TemplateParameters>;

Parameters to control the cloud formation stack template that is created. If not provided the defaults specified in TemplateParameters will be used.

property vpc

vpc?: x.ec2.Vpc;

The vpc this autoscaling group is for. If not provided this autoscaling group will be created for the default vpc.

interface AutoScalingLaunchConfigurationArgs

The set of arguments when creating the launch configuration for a cluster’s autoscaling group.

property associatePublicIpAddress

associatePublicIpAddress?: pulumi.Input<boolean>;

Associate a public ip address with an instance in a VPC.

property ebsBlockDevices

ebsBlockDevices?: undefined | {
    deleteOnTermination: pulumi.Input<boolean>;
    deviceName: pulumi.Input<string>;
    encrypted: pulumi.Input<boolean>;
    iops: pulumi.Input<number>;
    noDevice: pulumi.Input<boolean>;
    snapshotId: pulumi.Input<string>;
    volumeSize: pulumi.Input<number>;
    volumeType: pulumi.Input<string>;
} | Promise<{
    deleteOnTermination: pulumi.Input<boolean>;
    deviceName: pulumi.Input<string>;
    encrypted: pulumi.Input<boolean>;
    iops: pulumi.Input<number>;
    noDevice: pulumi.Input<boolean>;
    snapshotId: pulumi.Input<string>;
    volumeSize: pulumi.Input<number>;
    volumeType: pulumi.Input<string>;
}> | OutputInstance<{
    deleteOnTermination: pulumi.Input<boolean>;
    deviceName: pulumi.Input<string>;
    encrypted: pulumi.Input<boolean>;
    iops: pulumi.Input<number>;
    noDevice: pulumi.Input<boolean>;
    snapshotId: pulumi.Input<string>;
    volumeSize: pulumi.Input<number>;
    volumeType: pulumi.Input<string>;
}>[] | Promise<{
    deleteOnTermination: pulumi.Input<boolean>;
    deviceName: pulumi.Input<string>;
    encrypted: pulumi.Input<boolean>;
    iops: pulumi.Input<number>;
    noDevice: pulumi.Input<boolean>;
    snapshotId: pulumi.Input<string>;
    volumeSize: pulumi.Input<number>;
    volumeType: pulumi.Input<string>;
} | Promise<{
    deleteOnTermination: pulumi.Input<boolean>;
    deviceName: pulumi.Input<string>;
    encrypted: pulumi.Input<boolean>;
    iops: pulumi.Input<number>;
    noDevice: pulumi.Input<boolean>;
    snapshotId: pulumi.Input<string>;
    volumeSize: pulumi.Input<number>;
    volumeType: pulumi.Input<string>;
}> | OutputInstance<{
    deleteOnTermination: pulumi.Input<boolean>;
    deviceName: pulumi.Input<string>;
    encrypted: pulumi.Input<boolean>;
    iops: pulumi.Input<number>;
    noDevice: pulumi.Input<boolean>;
    snapshotId: pulumi.Input<string>;
    volumeSize: pulumi.Input<number>;
    volumeType: pulumi.Input<string>;
}>[]> | OutputInstance<{
    deleteOnTermination: pulumi.Input<boolean>;
    deviceName: pulumi.Input<string>;
    encrypted: pulumi.Input<boolean>;
    iops: pulumi.Input<number>;
    noDevice: pulumi.Input<boolean>;
    snapshotId: pulumi.Input<string>;
    volumeSize: pulumi.Input<number>;
    volumeType: pulumi.Input<string>;
} | Promise<{
    deleteOnTermination: pulumi.Input<boolean>;
    deviceName: pulumi.Input<string>;
    encrypted: pulumi.Input<boolean>;
    iops: pulumi.Input<number>;
    noDevice: pulumi.Input<boolean>;
    snapshotId: pulumi.Input<string>;
    volumeSize: pulumi.Input<number>;
    volumeType: pulumi.Input<string>;
}> | OutputInstance<{
    deleteOnTermination: pulumi.Input<boolean>;
    deviceName: pulumi.Input<string>;
    encrypted: pulumi.Input<boolean>;
    iops: pulumi.Input<number>;
    noDevice: pulumi.Input<boolean>;
    snapshotId: pulumi.Input<string>;
    volumeSize: pulumi.Input<number>;
    volumeType: pulumi.Input<string>;
}>[]>;

Additional EBS block devices to attach to the instance. See Block Devices below for details.

If not provided, a 5gb ‘gp2’ device will be mounted at ‘/dev/xvdb’ and a 50gb ‘gp2’ device will be mounted at ‘/dev/xvdcz’. Both devices will be deleted upon termination.

property ebsOptimized

ebsOptimized?: pulumi.Input<boolean>;

If true, the launched EC2 instance will be EBS-optimized.

property ecsOptimizedAMIName

ecsOptimizedAMIName?: undefined | string;

The name of the ECS-optimzed AMI to use for the Container Instances in this cluster, e.g. “amzn-ami-2017.09.l-amazon-ecs-optimized”. Defaults to using the latest recommended ECS Linux Optimized AMI, which may change over time and cause recreation of EC2 instances when new versions are release. To control when these changes are adopted, set this parameter explicitly to the version you would like to use.

See http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html for valid values.

property enableMonitoring

enableMonitoring?: pulumi.Input<boolean>;

Enables/disables detailed monitoring. This is enabled by default.

property ephemeralBlockDevices

ephemeralBlockDevices?: undefined | {
    deviceName: pulumi.Input<string>;
    virtualName: pulumi.Input<string>;
} | Promise<{
    deviceName: pulumi.Input<string>;
    virtualName: pulumi.Input<string>;
}> | OutputInstance<{
    deviceName: pulumi.Input<string>;
    virtualName: pulumi.Input<string>;
}>[] | Promise<{
    deviceName: pulumi.Input<string>;
    virtualName: pulumi.Input<string>;
} | Promise<{
    deviceName: pulumi.Input<string>;
    virtualName: pulumi.Input<string>;
}> | OutputInstance<{
    deviceName: pulumi.Input<string>;
    virtualName: pulumi.Input<string>;
}>[]> | OutputInstance<{
    deviceName: pulumi.Input<string>;
    virtualName: pulumi.Input<string>;
} | Promise<{
    deviceName: pulumi.Input<string>;
    virtualName: pulumi.Input<string>;
}> | OutputInstance<{
    deviceName: pulumi.Input<string>;
    virtualName: pulumi.Input<string>;
}>[]>;

Customize Ephemeral (also known as “Instance Store”) volumes on the instance. See Block Devices below for details.

property iamInstanceProfile

iamInstanceProfile?: pulumi.Input<string | aws.iam.InstanceProfile>;

The name attribute of the IAM instance profile to associate with launched instances.

property instanceProfile

instanceProfile?: aws.iam.InstanceProfile;

The instance profile to use for the autoscaling group. If not provided, a default one will be created.

property instanceType

instanceType?: pulumi.Input<aws.ec2.InstanceType>;

The size of instance to launch. Defaults to t2.micro if unspecified.

property keyName

keyName?: pulumi.Input<string>;

The key name that should be used for the instance.

property name

name?: pulumi.Input<string>;

The name of the launch configuration. If you leave this blank, Terraform will auto-generate a unique name.

property namePrefix

namePrefix?: pulumi.Input<string>;

Creates a unique name beginning with the specified prefix. Conflicts with name.

property placementTenancy

placementTenancy?: pulumi.Input<“default” | “dedicated”>;

The tenancy of the instance. Valid values are "default" or "dedicated", see http://docs.aws.amazon.com/AutoScaling/latest/APIReference/API_CreateLaunchConfiguration.html for more details. Default is “default” if unspecified.

property rootBlockDevice

rootBlockDevice?: undefined | {
    deleteOnTermination: pulumi.Input<boolean>;
    iops: pulumi.Input<number>;
    volumeSize: pulumi.Input<number>;
    volumeType: pulumi.Input<string>;
} | Promise<{
    deleteOnTermination: pulumi.Input<boolean>;
    iops: pulumi.Input<number>;
    volumeSize: pulumi.Input<number>;
    volumeType: pulumi.Input<string>;
}> | OutputInstance<{
    deleteOnTermination: pulumi.Input<boolean>;
    iops: pulumi.Input<number>;
    volumeSize: pulumi.Input<number>;
    volumeType: pulumi.Input<string>;
}>;

Customize details about the root block device of the instance. See Block Devices below for details.

If not provided, an 8gb ‘gp2’ root device will be created. This device will be deleted upon termination.

property securityGroups

securityGroups?: x.ec2.SecurityGroupOrId[];

A list of associated security group IDs.

property spotPrice

spotPrice?: pulumi.Input<string>;

The maximum price to use for reserving spot instances.

property stackName

stackName?: pulumi.Input<string>;

The name of the stack the launch configuration will signal.

property userData

userData?: pulumi.Input<string> | AutoScalingUserData;

The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see user_data_base64 instead.

property userDataBase64

userDataBase64?: pulumi.Input<string>;

Can be used instead of user_data to pass base64-encoded binary data directly. Use this instead of user_data whenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption.

property vpcClassicLinkId

vpcClassicLinkId?: pulumi.Input<string>;

The ID of a ClassicLink-enabled VPC. Only applies to EC2-Classic instances. (eg. vpc-2730681a)

property vpcClassicLinkSecurityGroups

vpcClassicLinkSecurityGroups?: pulumi.Input<pulumi.Input<string>[]>;

The IDs of one or more security groups for the specified ClassicLink-enabled VPC (eg. sg-46ae3d11).

interface AutoScalingUserData

method extraBootcmdLines

extraBootcmdLines(): pulumi.Input<UserDataLine[]>

Additional lines to be placed in the bootcmd section of the launch configuration.

method extraRuncmdLines

extraRuncmdLines(): pulumi.Input<UserDataLine[]>

Additional lines to be placed in the runcmd section of the launch configuration.

interface CustomMetricTargetTrackingPolicyArgs

extends TargetTrackingPolicyArgs

Represents a CloudWatch metric of your choosing for a target tracking scaling policy to use with Amazon EC2 Auto Scaling.

To create your customized metric specification:

  • Add values for each required parameter from CloudWatch. You can use an existing metric, or a new metric that you create. To use your own metric, you must first publish the metric to CloudWatch. For more information, see Publish-Custom-Metrics in the Amazon CloudWatch User Guide.

  • Choose a metric that changes proportionally with capacity. The value of the metric should increase or decrease in inverse proportion to the number of capacity units. That is, the value of the metric should decrease when capacity increases.

property disableScaleIn

disableScaleIn?: pulumi.Input<boolean>;

Indicates whether scaling in by the target tracking scaling policy is disabled. If scaling in is disabled, the target tracking scaling policy doesn’t remove instances from the Auto Scaling group. Otherwise, the target tracking scaling policy can remove instances from the Auto Scaling group. Defaults to [false] if unspecified.

property estimatedInstanceWarmup

estimatedInstanceWarmup?: pulumi.Input<number>;

The estimated time, in seconds, until a newly launched instance will contribute CloudWatch metrics. Without a value, AWS will default to the group’s specified cooldown period.

property metric

metric: x.cloudwatch.Metric;

The metric to track

property targetValue

targetValue: pulumi.Input<number>;

The target value for the metric.

interface ScalingStep

property adjustment

adjustment: pulumi.Input<number>;

The number of members by which to scale, when [value] breached. A positive value scales up. A negative value scales down.

property value

value: pulumi.Input<number>;

The threshold value that causes this step to be followed. If this an upperStep then values >= to this will trigger this step’s [scalingAdjustment]. If this is a lowerStep then values <= to this will trigger this step’s [scalingAdjustment].

interface ScalingSteps

property lower

lower?: pulumi.Input<ScalingStep>[];

Optional lower steps for this step policy normally used to describe how to scale-in the AutoScalingGroup. If these are provided then the step policy will create two alarms. One for when the upper steps are breached and one for when the lower steps are breached.

The latter alarm will fire when the desired metric goes less-than-or-equal-to the value of the first step’s value. Each step ranges from it’s value (inclusive) to the value of the next step (exclusive). For the last step, the end part of the range is -Infinity.

Depending on which step range the alarm triggers for will determine which particular [scalingAdjustment] will be performed.

At least one of upper or lower must be non-empty. If both are provided, upper and lower must not overlap.

property upper

upper?: pulumi.Input<ScalingStep>[];

Optional upper steps for this policy normally describing how to scale-out the AutoScalingGroup. This must be non-empty. An alarm will be created that will fire when the desired metric goes greater-than-or-equal-to the value of the first step’s value. Each step ranges from it’s value (inclusive) to the value of the next step (exclusive). For the last step, the end part of the range is Infinity.

Depending on which step range the alarm triggers for will determine which particular [scalingAdjustment] will be performed.

At least one of upper or lower must be non-empty. If both are provided, upper and lower must not overlap.

interface ScheduleArgs

property desiredCapacity

desiredCapacity?: pulumi.Input<number>;

The number of EC2 instances that should be running in the group. Do not pass a value if you don’t want to change the size at the scheduled time.

property endTime

endTime?: pulumi.Input<string>;

The time for this action to end, in “YYYY-MM-DDThh:mm:ssZ” format in UTC/GMT only (for example, 2014-06-01T00:00:00Z ). If you try to schedule your action in the past, Auto Scaling returns an error message.

property maxSize

maxSize?: pulumi.Input<number>;

The maximum size for the Auto Scaling group. Do not pass a value if you don’t want to change the size at the scheduled time.

property minSize

minSize?: pulumi.Input<number>;

The minimum size for the Auto Scaling group. Do not pass a value if you don’t want to change the size at the scheduled time.

property recurrence

recurrence?: pulumi.Input<string | ScheduleRecurrenceArgs>;

The time when recurring future actions will start. Start time is specified by the user following the Unix cron syntax format. [cronExpression] can be used to easily create values of this.

property scheduledActionName

scheduledActionName?: pulumi.Input<string>;

The name of this scaling action. If not provided, the name of the requested [aws.autoscaling.Schedule] will be used for this.

property startTime

startTime?: pulumi.Input<string>;

The time for this action to start, in “YYYY-MM-DDThh:mm:ssZ” format in UTC/GMT only (for example, 2014-06-01T00:00:00Z ). If you try to schedule your action in the past, Auto Scaling returns an error message.

interface ScheduleRecurrenceArgs

property dayOfMonth

dayOfMonth?: undefined | number;

1 to 31. Leave undefined to indicate no specific value.

property dayOfWeek

dayOfWeek?: DayOfWeek;

Day of the week to perform the scheduled action on. Leave undefined to indicate no specific value.

property hour

hour?: undefined | number;

0 to 23. Leave undefined to indicate no specific value. All times UTC

property minute

minute?: undefined | number;

0 to 59. Leave undefined to indicate no specific value.

property month

month?: Month;

Month of the year to perform the scheduled action on. Leave undefined to indicate no specific value.

interface StepScalingPolicyArgs

property adjustmentType

adjustmentType: pulumi.Input<AdjustmentType>;

When a step scaling or simple scaling policy is executed, it changes the current capacity of your Auto Scaling group using the scaling adjustment specified in the policy. A scaling adjustment can’t change the capacity of the group above the maximum group size or below the minimum group size.

property estimatedInstanceWarmup

estimatedInstanceWarmup?: pulumi.Input<number>;

The estimated time, in seconds, until a newly launched instance will contribute CloudWatch metrics. Without a value, AWS will default to the group’s specified cooldown period.

property evaluationPeriods

evaluationPeriods?: pulumi.Input<number>;

The number of periods over which data is compared to the specified threshold before an alarm is fired. Defaults to 1 if unspecified.

property metric

metric: x.cloudwatch.Metric;

The metric to use to watch for changes. An alarm will be created from this using [alarmArgs], which will invoke the actual autoscaling policy when triggered.

Note: the period of this metric will be set to 60s from the default of 300s to ensure events come in in a timely enough manner to allow the ASG to respond accordingly.

property minAdjustmentMagnitude

minAdjustmentMagnitude?: pulumi.Input<number>;

The minimum number of instances to scale. If the value of [adjustmentType] is [“PercentChangeInCapacity”], the scaling policy changes the DesiredCapacity of the Auto Scaling group by at least this many instances. Defaults to 1 if not specified.

property steps

steps: ScalingSteps;

A set of adjustments that manage group scaling.

interface TargetTrackingPolicyArgs

property disableScaleIn

disableScaleIn?: pulumi.Input<boolean>;

Indicates whether scaling in by the target tracking scaling policy is disabled. If scaling in is disabled, the target tracking scaling policy doesn’t remove instances from the Auto Scaling group. Otherwise, the target tracking scaling policy can remove instances from the Auto Scaling group. Defaults to [false] if unspecified.

property estimatedInstanceWarmup

estimatedInstanceWarmup?: pulumi.Input<number>;

The estimated time, in seconds, until a newly launched instance will contribute CloudWatch metrics. Without a value, AWS will default to the group’s specified cooldown period.

property targetValue

targetValue: pulumi.Input<number>;

The target value for the metric.

interface TemplateParameters

property defaultCooldown

defaultCooldown?: pulumi.Input<number>;

The amount of time, in seconds, after a scaling activity completes before another scaling activity can start. Defaults to 300 if unspecified.

property desiredCapacity

desiredCapacity?: pulumi.Input<number>;

The desired size of the auto scale group. Defaults to [minSize] if unspecified.

property healthCheckGracePeriod

healthCheckGracePeriod?: pulumi.Input<number>;

Time (in seconds) after instance comes into service before checking health. Defaults to 120 if unspecified.

property healthCheckType

healthCheckType?: pulumi.Input<“EC2” | “ELB”>;

“EC2” or “ELB”. Controls how health checking is done. Defaults to “EC2” if unspecified.

property maxSize

maxSize?: pulumi.Input<number>;

The maximum size of the auto scale group. Defaults to 100 if unspecified.

property minSize

minSize?: pulumi.Input<number>;

The minimum size of the auto scale group. Defaults to 2 if unspecified.

property suspendedProcesses

suspendedProcesses?: pulumi.Input<pulumi.Input<“Launch” | “Terminate” | “HealthCheck” | “ReplaceUnhealthy” | “AZRebalance” | “AlarmNotification” | “ScheduledActions” | “AddToLoadBalancer”>[]>;

A list of processes to suspend for the AutoScaling Group. The allowed values are Launch, Terminate, HealthCheck, ReplaceUnhealthy, AZRebalance, AlarmNotification, ScheduledActions, AddToLoadBalancer. Note that if you suspend either the Launch or Terminate process types, it can prevent your autoscaling group from functioning properly.

Defaults to “ScheduledActions” if not specified

interface UserDataLine

A line that should be added to the [userData] section of a LaunchConfiguration template.

property automaticallyIndent

automaticallyIndent?: undefined | false | true;

Whether the line should be automatically indented to the right level. Defaults to [true]. Set explicitly to [false] to control all indentation.

property contents

contents: string;

Actual contents of the line.

module metrics

function groupDesiredCapacity

groupDesiredCapacity(change?: AutoScalingMetricChange): Metric

The number of instances that the Auto Scaling group attempts to maintain.

function groupInServiceInstances

groupInServiceInstances(change?: AutoScalingMetricChange): Metric

The number of instances that are running as part of the Auto Scaling group. This metric does not include instances that are pending or terminating.

function groupMaxSize

groupMaxSize(change?: AutoScalingMetricChange): Metric

The maximum size of the Auto Scaling group.

function groupMinSize

groupMinSize(change?: AutoScalingMetricChange): Metric

The minimum size of the Auto Scaling group.

function groupPendingInstances

groupPendingInstances(change?: AutoScalingMetricChange): Metric

The number of instances that are pending. A pending instance is not yet in service. This metric does not include instances that are in service or terminating.

function groupStandbyInstances

groupStandbyInstances(change?: AutoScalingMetricChange): Metric

The number of instances that are in a Standby state. Instances in this state are still running but are not actively in service.

function groupTerminatingInstances

groupTerminatingInstances(change?: AutoScalingMetricChange): Metric

The number of instances that are in the process of terminating. This metric does not include instances that are in service or pending.

function groupTotalInstances

groupTotalInstances(change?: AutoScalingMetricChange): Metric

The total number of instances in the Auto Scaling group. This metric identifies the number of instances that are in service, pending, and terminating.

function metric

metric(metricName: aws.autoscaling.Metric, change: AutoScalingMetricChange): Metric

Creates an AWS/AutoScaling metric with the requested [metricName]. See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/viewing_metrics_with_cloudwatch.html for list of all metric-names.

Note, individual metrics can easily be obtained without supplying the name using the other [metricXXX] functions.

Amazon CloudWatch enables you to retrieve statistics as an ordered set of time-series data, known as metrics. You can use these metrics to verify that your system is performing as expected.

Amazon EC2 sends metrics to CloudWatch that describe your Auto Scaling instances. These metrics are available for any EC2 instance, not just those in an Auto Scaling group. For more information, see Instance Metrics in the Amazon EC2 User Guide for Linux Instances.

Auto Scaling groups can send metrics to CloudWatch that describe the group itself. You must enable these metrics.

To filter the metrics for your Auto Scaling group by group name, use the “AutoScalingGroupName” dimension.

interface AutoScalingMetricChange

type AdjustmentType

type AdjustmentType = “ChangeInCapacity” | “ExactCapacity” | “PercentChangeInCapacity”;

type DayOfWeek

type DayOfWeek = number | “Monday” | “Tuesday” | “Wednesday” | “Thursday” | “Friday” | “Saturday” | “Sunday”;

If a number, it must be between 0 to 7 (inclusive). (0 and 7 both represent Sunday). Leave undefined to indicate no specific value.

type Month

type Month = number | “January” | “February” | “March” | “April” | “May” | “June” | “July” | “August” | “September” | “October” | “November” | “December”;

If a number, it must be between 1 to 12 (inclusive). Leave undefined to indicate no specific value.