Schedule class

Provides an AutoScaling Schedule resource.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const foobar = new aws.autoscaling.Group("foobar", {
    availabilityZones: ["us-west-2a"],
    name: "test-foobar5",
    maxSize: 1,
    minSize: 1,
    healthCheckGracePeriod: 300,
    healthCheckType: "ELB",
    forceDelete: true,
    terminationPolicies: ["OldestInstance"],
});
const foobarSchedule = new aws.autoscaling.Schedule("foobar", {
    scheduledActionName: "foobar",
    minSize: 0,
    maxSize: 1,
    desiredCapacity: 0,
    startTime: "2016-12-11T18:00:00Z",
    endTime: "2016-12-12T06:00:00Z",
    autoscalingGroupName: foobar.name,
});
import pulumi
import pulumi_aws as aws

foobar = aws.autoscaling.Group("foobar",
    availability_zones=["us-west-2a"],
    name="test-foobar5",
    max_size=1,
    min_size=1,
    health_check_grace_period=300,
    health_check_type="ELB",
    force_delete=True,
    termination_policies=["OldestInstance"])
foobar_schedule = aws.autoscaling.Schedule("foobar",
    scheduled_action_name="foobar",
    min_size=0,
    max_size=1,
    desired_capacity=0,
    start_time="2016-12-11T18:00:00Z",
    end_time="2016-12-12T06:00:00Z",
    autoscaling_group_name=foobar.name)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var foobar = new Aws.AutoScaling.Group("foobar", new()
    {
        AvailabilityZones = new[]
        {
            "us-west-2a",
        },
        Name = "test-foobar5",
        MaxSize = 1,
        MinSize = 1,
        HealthCheckGracePeriod = 300,
        HealthCheckType = "ELB",
        ForceDelete = true,
        TerminationPolicies = new[]
        {
            "OldestInstance",
        },
    });

    var foobarSchedule = new Aws.AutoScaling.Schedule("foobar", new()
    {
        ScheduledActionName = "foobar",
        MinSize = 0,
        MaxSize = 1,
        DesiredCapacity = 0,
        StartTime = "2016-12-11T18:00:00Z",
        EndTime = "2016-12-12T06:00:00Z",
        AutoscalingGroupName = foobar.Name,
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/autoscaling"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		foobar, err := autoscaling.NewGroup(ctx, "foobar", &autoscaling.GroupArgs{
			AvailabilityZones: pulumi.StringArray{
				pulumi.String("us-west-2a"),
			},
			Name:                   pulumi.String("test-foobar5"),
			MaxSize:                pulumi.Int(1),
			MinSize:                pulumi.Int(1),
			HealthCheckGracePeriod: pulumi.Int(300),
			HealthCheckType:        pulumi.String("ELB"),
			ForceDelete:            pulumi.Bool(true),
			TerminationPolicies: pulumi.StringArray{
				pulumi.String("OldestInstance"),
			},
		})
		if err != nil {
			return err
		}
		_, err = autoscaling.NewSchedule(ctx, "foobar", &autoscaling.ScheduleArgs{
			ScheduledActionName:  pulumi.String("foobar"),
			MinSize:              pulumi.Int(0),
			MaxSize:              pulumi.Int(1),
			DesiredCapacity:      pulumi.Int(0),
			StartTime:            pulumi.String("2016-12-11T18:00:00Z"),
			EndTime:              pulumi.String("2016-12-12T06:00:00Z"),
			AutoscalingGroupName: foobar.Name,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_autoscaling_group" "foobar" {
  availability_zones        = ["us-west-2a"]
  name                      = "test-foobar5"
  max_size                  = 1
  min_size                  = 1
  health_check_grace_period = 300
  health_check_type         = "ELB"
  force_delete              = true
  termination_policies      = ["OldestInstance"]
}
resource "aws_autoscaling_schedule" "foobar" {
  scheduled_action_name  = "foobar"
  min_size               = 0
  max_size               = 1
  desired_capacity       = 0
  start_time             = "2016-12-11T18:00:00Z"
  end_time               = "2016-12-12T06:00:00Z"
  autoscaling_group_name = aws_autoscaling_group.foobar.name
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.autoscaling.Group;
import com.pulumi.aws.autoscaling.GroupArgs;
import com.pulumi.aws.autoscaling.Schedule;
import com.pulumi.aws.autoscaling.ScheduleArgs;
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 foobar = new Group("foobar", GroupArgs.builder()
            .availabilityZones("us-west-2a")
            .name("test-foobar5")
            .maxSize(1)
            .minSize(1)
            .healthCheckGracePeriod(300)
            .healthCheckType("ELB")
            .forceDelete(true)
            .terminationPolicies("OldestInstance")
            .build());

        var foobarSchedule = new Schedule("foobarSchedule", ScheduleArgs.builder()
            .scheduledActionName("foobar")
            .minSize(0)
            .maxSize(1)
            .desiredCapacity(0)
            .startTime("2016-12-11T18:00:00Z")
            .endTime("2016-12-12T06:00:00Z")
            .autoscalingGroupName(foobar.name())
            .build());

    }
}
resources:
  foobar:
    type: aws:autoscaling:Group
    properties:
      availabilityZones:
        - us-west-2a
      name: test-foobar5
      maxSize: 1
      minSize: 1
      healthCheckGracePeriod: 300
      healthCheckType: ELB
      forceDelete: true
      terminationPolicies:
        - OldestInstance
  foobarSchedule:
    type: aws:autoscaling:Schedule
    name: foobar
    properties:
      scheduledActionName: foobar
      minSize: 0
      maxSize: 1
      desiredCapacity: 0
      startTime: 2016-12-11T18:00:00Z
      endTime: 2016-12-12T06:00:00Z
      autoscalingGroupName: ${foobar.name}

Import

Identity Schema

Required

  • autoscalingGroupName (String) Name of the Auto Scaling group.
  • scheduledActionName (String) Name of the scaling action.

Optional

  • accountId (String) AWS Account where this resource is managed.
  • region (String) Region where this resource is managed.

Using pulumi import, import AutoScaling Schedules using autoscalingGroupName and scheduledActionName separated by a forward slash (/). For example:

$ pulumi import aws:autoscaling/schedule:Schedule example example-asg/example-action

Constructors

Schedule(String name, {ScheduleArgs? args, CustomResourceOptions? options})
Creates a new Schedule. name The Pulumi resource name. args Arguments used to configure this Schedule. The set of arguments for Schedule. options Resource options controlling this resource's behavior.
Schedule.reference(String urn)
Creates a typed reference to an existing Schedule resource.

Properties

arn ↔ Output<String>
ARN assigned by AWS to the autoscaling schedule.
latefinal
autoscalingGroupName ↔ Output<String>
The name of the Auto Scaling group.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
desiredCapacity ↔ Output<int>
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.
latefinal
endTime ↔ Output<String>
The date and time for the recurring schedule to end, in UTC with the format "YYYY-MM-DDThh:mm:ssZ" (e.g. "2021-06-01T00:00:00Z").
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
maxSize ↔ Output<int>
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.
latefinal
minSize ↔ Output<int>
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.
latefinal
recurrence ↔ Output<String>
The recurring schedule for this action specified using the Unix cron syntax format.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scheduledActionName ↔ Output<String>
The name of this scaling action.
latefinal
startTime ↔ Output<String>
The date and time for the recurring schedule to start, in UTC with the format "YYYY-MM-DDThh:mm:ssZ" (e.g. "2021-06-01T00:00:00Z").
latefinal
timeZone ↔ Output<String>
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).
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {ScheduleState? state, CustomResourceOptions? options}) → Schedule
Gets an existing Schedule resource's state with the given name and id.