Skip to content

Schedules ​

Scheduled Deployments in Pulumi Cloud introduce a robust capability to automate cloud operations, enabling more control over when and how infrastructure updates are applied. This feature is ideal for teams looking to enhance operational efficiency by automating routine tasks and ensuring that changes are made during optimal times, such as off-peak hours or predetermined maintenance windows.

Users can easily define schedules for any stack with Pulumi Deployments configured, using cron expressions to specify exact times for operations. This granular level of control allows for precise management of infrastructure tasks, accommodating complex scheduling needs. Scheduled Deployments build upon the existing infrastructure provided by Pulumi Deployments, enhancing it with the flexibility to manage deployment timing extensively. This means Pulumi Deployments concurrency limits apply to scheduled deployments and pausing deployments on a stack will queue scheduled deployments as well.

Time zones ​

Schedules run in UTC unless the cron expression starts with CRON_TZ= followed by an IANA time zone name. For example, CRON_TZ=America/New_York 0 9 * * * runs at 9:00 AM New York time and follows daylight saving time changes. Pulumi Cloud rejects an expression whose time zone name it doesn't recognize.

The same rule applies to every Pulumi Cloud schedule that takes a cron expression, including drift detection and ESC secret rotation schedules.

Pulumi Cloud UI ​

In order to set up a deployment schedule in the Pulumi Cloud console, follow these steps:

  1. Ensure Deployments Settings are configured on the stack see the docs
  2. Navigate to the stack > Settings > Schedules
  3. Select "Raw operation"
  4. Select from the drop-down the type of operation you would like to schedule
  5. Set the schedule using a cron expression
  6. Save the Schedule

Setting it up in the API ​

For those who prefer to automate and script their infrastructure tasks, scheduled deployments can be configured programmatically using simple HTTP requests.

  • Create a schedule
  • Get a schedule for a stack
  • Update or delete a schedule
  • Pause or resume a schedule
  • List all schedules in the organization (includes Drift and Time-to-Live schedules)

Below is an example of creating a Schedule on a stack programmatically:

bash
curl \
  -H "Accept: application/vnd.pulumi+8" \
  -H "Content-Type: application/json" \
  -H "Authorization: token $PULUMI_ACCESS_TOKEN" \
  --request POST \
  --data '{ "scheduleCron":"0 0 * * *", "request": { "operation": "update" } }' \
  https://api.pulumi.com/api/stacks/{organization}/{project}/{stack}/deployments/schedules

Refer to the Pulumi Deployments REST API documentation for more details on how to use the REST API to manage Scheduled Deployments.

Pulumi Cloud provider ​

typescript
import * as pulumi from "@pulumi/pulumi";
import * as pulumiservice from "@pulumi/pulumiservice";

const organizationName = "my-org";
const projectName = "my-project";
const stackName = "prod-stack";

const rawSchedule = new pulumiservice.DeploymentSchedule("rawSchedule", {
    organization: organizationName,
    project: projectName,
    stack: stackName,
    scheduleCron: "0 0 * * *", // Run an update daily at midnight UTC
    pulumiOperation: pulumiservice.PulumiOperation.update
});

export const scheduleId = rawSchedule.scheduleId;

See the Pulumi Service Provider documentation for more details on how to manage Scheduled Deployments in source control.

Content from the official Pulumi documentation (github.com/pulumi/docs).