Skip to content

Resource: awsAutoscalingSchedule

Provides an AutoScaling Schedule resource.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsAutoscalingGroupFoobar = new aws.autoscalingGroup.AutoscalingGroup(
  this,
  "foobar",
  {
    availabilityZones: ["us-west-2a"],
    forceDelete: true,
    healthCheckGracePeriod: 300,
    healthCheckType: "ELB",
    maxSize: 1,
    minSize: 1,
    name: "terraform-test-foobar5",
    terminationPolicies: ["OldestInstance"],
  }
);
const awsAutoscalingScheduleFoobar =
  new aws.autoscalingSchedule.AutoscalingSchedule(this, "foobar_1", {
    autoscalingGroupName: awsAutoscalingGroupFoobar.name,
    desiredCapacity: 0,
    endTime: "2016-12-12T06:00:00Z",
    maxSize: 1,
    minSize: 0,
    scheduledActionName: "foobar",
    startTime: "2016-12-11T18:00:00Z",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsAutoscalingScheduleFoobar.overrideLogicalId("foobar");

Argument Reference

The following arguments are required:

  • autoscalingGroupName - (Required) The name of the Auto Scaling group.
  • scheduledActionName - (Required) The name of this scaling action.

The following arguments are optional:

  • desiredCapacity - (Optional) The initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain. Set to 1 if you don't want to change the desired capacity at the scheduled time. Defaults to 0.
  • endTime - (Optional) The date and time for the recurring schedule to end, in UTC with the format "yyyyMmDdThh:mm:ssZ" (e.g. "20210601T00:00:00Z").
  • maxSize - (Optional) The maximum size of the Auto Scaling group. Set to 1 if you don't want to change the maximum size at the scheduled time. Defaults to 0.
  • minSize - (Optional) The minimum size of the Auto Scaling group. Set to 1 if you don't want to change the minimum size at the scheduled time. Defaults to 0.
  • recurrence - (Optional) The recurring schedule for this action specified using the Unix cron syntax format.
  • startTime - (Optional) The date and time for the recurring schedule to start, in UTC with the format "yyyyMmDdThh:mm:ssZ" (e.g. "20210601T00:00:00Z").
  • timeZone - (Optional) Specifies the time zone for a cron expression. Valid values are the canonical names of the IANA time zones (such as etc/gmt+9 or pacific/tahiti).

\~> NOTE: When startTime and endTime are specified with recurrence , they form the boundaries of when the recurring action will start and stop.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • arn - ARN assigned by AWS to the autoscaling schedule.

Import

AutoScaling ScheduledAction can be imported using the autoScalingGroupName and scheduledActionName, e.g.,

$ terraform import aws_autoscaling_schedule.resource-name auto-scaling-group-name/scheduled-action-name