Schedule class
Provides an EventBridge Scheduler Schedule resource.
You can find out more about EventBridge Scheduler in the User Guide.
> Note: EventBridge was formerly known as CloudWatch Events. The functionality is identical.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.scheduler.Schedule("example", {
flexibleTimeWindow: {
mode: "OFF",
},
target: {
arn: exampleAwsSqsQueue.arn,
roleArn: exampleAwsIamRole.arn,
},
name: "my-schedule",
groupName: "default",
scheduleExpression: "rate(1 hours)",
});
import pulumi
import pulumi_aws as aws
example = aws.scheduler.Schedule("example",
flexible_time_window={
"mode": "OFF",
},
target={
"arn": example_aws_sqs_queue["arn"],
"role_arn": example_aws_iam_role["arn"],
},
name="my-schedule",
group_name="default",
schedule_expression="rate(1 hours)")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Scheduler.Schedule("example", new()
{
FlexibleTimeWindow = new Aws.Scheduler.Inputs.ScheduleFlexibleTimeWindowArgs
{
Mode = "OFF",
},
Target = new Aws.Scheduler.Inputs.ScheduleTargetArgs
{
Arn = exampleAwsSqsQueue.Arn,
RoleArn = exampleAwsIamRole.Arn,
},
Name = "my-schedule",
GroupName = "default",
ScheduleExpression = "rate(1 hours)",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/scheduler"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := scheduler.NewSchedule(ctx, "example", &scheduler.ScheduleArgs{
FlexibleTimeWindow: &scheduler.ScheduleFlexibleTimeWindowArgs{
Mode: pulumi.String("OFF"),
},
Target: &scheduler.ScheduleTargetArgs{
Arn: pulumi.Any(exampleAwsSqsQueue.Arn),
RoleArn: pulumi.Any(exampleAwsIamRole.Arn),
},
Name: pulumi.String("my-schedule"),
GroupName: pulumi.String("default"),
ScheduleExpression: pulumi.String("rate(1 hours)"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_scheduler_schedule" "example" {
flexible_time_window = {
mode = "OFF"
}
target = {
arn = exampleAwsSqsQueue.arn
role_arn = exampleAwsIamRole.arn
}
name = "my-schedule"
group_name = "default"
schedule_expression = "rate(1 hours)"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.scheduler.Schedule;
import com.pulumi.aws.scheduler.ScheduleArgs;
import com.pulumi.aws.scheduler.inputs.ScheduleFlexibleTimeWindowArgs;
import com.pulumi.aws.scheduler.inputs.ScheduleTargetArgs;
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 example = new Schedule("example", ScheduleArgs.builder()
.flexibleTimeWindow(ScheduleFlexibleTimeWindowArgs.builder()
.mode("OFF")
.build())
.target(ScheduleTargetArgs.builder()
.arn(exampleAwsSqsQueue.arn())
.roleArn(exampleAwsIamRole.arn())
.build())
.name("my-schedule")
.groupName("default")
.scheduleExpression("rate(1 hours)")
.build());
}
}
resources:
example:
type: aws:scheduler:Schedule
properties:
flexibleTimeWindow:
mode: OFF
target:
arn: ${exampleAwsSqsQueue.arn}
roleArn: ${exampleAwsIamRole.arn}
name: my-schedule
groupName: default
scheduleExpression: rate(1 hours)
Universal Target
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.sqs.Queue("example", {});
const exampleSchedule = new aws.scheduler.Schedule("example", {
flexibleTimeWindow: {
mode: "OFF",
},
target: {
arn: "arn:aws:scheduler:::aws-sdk:sqs:sendMessage",
roleArn: exampleAwsIamRole.arn,
input: pulumi.jsonStringify({
MessageBody: "Greetings, programs!",
QueueUrl: example.url,
}),
},
name: "my-schedule",
scheduleExpression: "rate(1 hours)",
});
import pulumi
import json
import pulumi_aws as aws
example = aws.sqs.Queue("example")
example_schedule = aws.scheduler.Schedule("example",
flexible_time_window={
"mode": "OFF",
},
target={
"arn": "arn:aws:scheduler:::aws-sdk:sqs:sendMessage",
"role_arn": example_aws_iam_role["arn"],
"input": pulumi.Output.json_dumps({
"MessageBody": "Greetings, programs!",
"QueueUrl": example.url,
}),
},
name="my-schedule",
schedule_expression="rate(1 hours)")
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Sqs.Queue("example");
var exampleSchedule = new Aws.Scheduler.Schedule("example", new()
{
FlexibleTimeWindow = new Aws.Scheduler.Inputs.ScheduleFlexibleTimeWindowArgs
{
Mode = "OFF",
},
Target = new Aws.Scheduler.Inputs.ScheduleTargetArgs
{
Arn = "arn:aws:scheduler:::aws-sdk:sqs:sendMessage",
RoleArn = exampleAwsIamRole.Arn,
Input = Output.JsonSerialize(Output.Create(new Dictionary<string, object?>
{
["MessageBody"] = "Greetings, programs!",
["QueueUrl"] = example.Url,
})),
},
Name = "my-schedule",
ScheduleExpression = "rate(1 hours)",
});
});
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/scheduler"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sqs"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := sqs.NewQueue(ctx, "example", nil)
if err != nil {
return err
}
_, err = scheduler.NewSchedule(ctx, "example", &scheduler.ScheduleArgs{
FlexibleTimeWindow: &scheduler.ScheduleFlexibleTimeWindowArgs{
Mode: pulumi.String("OFF"),
},
Target: &scheduler.ScheduleTargetArgs{
Arn: pulumi.String("arn:aws:scheduler:::aws-sdk:sqs:sendMessage"),
RoleArn: pulumi.Any(exampleAwsIamRole.Arn),
Input: example.Url.ApplyT(func(url string) (pulumi.String, error) {
var _zero pulumi.String
tmpJSON0, err := json.Marshal(map[string]string{
"MessageBody": "Greetings, programs!",
"QueueUrl": url,
})
if err != nil {
return _zero, err
}
json0 := string(tmpJSON0)
return pulumi.String(json0), nil
}).(pulumi.StringOutput),
},
Name: pulumi.String("my-schedule"),
ScheduleExpression: pulumi.String("rate(1 hours)"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_sqs_queue" "example" {
}
resource "aws_scheduler_schedule" "example" {
flexible_time_window = {
mode = "OFF"
}
target = {
arn = "arn:aws:scheduler:::aws-sdk:sqs:sendMessage"
role_arn = exampleAwsIamRole.arn
input = jsonencode({
"MessageBody" = "Greetings, programs!"
"QueueUrl" = aws_sqs_queue.example.url
})
}
name = "my-schedule"
schedule_expression = "rate(1 hours)"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sqs.Queue;
import com.pulumi.aws.scheduler.Schedule;
import com.pulumi.aws.scheduler.ScheduleArgs;
import com.pulumi.aws.scheduler.inputs.ScheduleFlexibleTimeWindowArgs;
import com.pulumi.aws.scheduler.inputs.ScheduleTargetArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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 example = new Queue("example");
var exampleSchedule = new Schedule("exampleSchedule", ScheduleArgs.builder()
.flexibleTimeWindow(ScheduleFlexibleTimeWindowArgs.builder()
.mode("OFF")
.build())
.target(ScheduleTargetArgs.builder()
.arn("arn:aws:scheduler:::aws-sdk:sqs:sendMessage")
.roleArn(exampleAwsIamRole.arn())
.input(example.url().applyValue(_url -> serializeJson(
jsonObject(
jsonProperty("MessageBody", "Greetings, programs!"),
jsonProperty("QueueUrl", _url)
))))
.build())
.name("my-schedule")
.scheduleExpression("rate(1 hours)")
.build());
}
}
resources:
example:
type: aws:sqs:Queue
exampleSchedule:
type: aws:scheduler:Schedule
name: example
properties:
flexibleTimeWindow:
mode: OFF
target:
arn: arn:aws:scheduler:::aws-sdk:sqs:sendMessage
roleArn: ${exampleAwsIamRole.arn}
input:
fn::toJSON:
MessageBody: Greetings, programs!
QueueUrl: ${example.url}
name: my-schedule
scheduleExpression: rate(1 hours)
Import
Identity Schema
Required
groupName- (String) Name of the schedule group.name- (String) Name of the schedule.
Optional
accountId(String) AWS Account where this resource is managed.region(String) Region where this resource is managed.
Using pulumi import, import schedules using the combination group_name/name. For example:
$ pulumi import aws:scheduler/schedule:Schedule example my-schedule-group/my-schedule
Constructors
- Schedule(String name, {ScheduleArgs? args, CustomResourceOptions? options})
-
Creates a new Schedule.
nameThe Pulumi resource name.argsArguments used to configure this Schedule. The set of arguments for Schedule.optionsResource options controlling this resource's behavior. - Schedule.reference(String urn)
- Creates a typed reference to an existing Schedule resource.
Properties
-
actionAfterCompletion
↔ Output<
String> -
Action that applies to the schedule after completing invocation of the target. Valid values are
NONEandDELETE. Defaults toNONE.latefinal -
arn
↔ Output<
String> -
ARN of the schedule.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
description
↔ Output<
String?> -
Brief description of the schedule.
latefinal
-
endDate
↔ Output<
String?> -
The date, in UTC, before which the schedule can invoke its target. Depending on the schedule's recurrence expression, invocations might stop on, or before, the end date you specify. EventBridge Scheduler ignores the end date for one-time schedules. Example:
2030-01-01T01:00:00Z.latefinal -
flexibleTimeWindow
↔ Output<
ScheduleFlexibleTimeWindow> -
Configures a time window during which EventBridge Scheduler invokes the schedule. Detailed below.
latefinal
-
groupName
↔ Output<
String> -
Name of the schedule group to associate with this schedule. When omitted, the
defaultschedule group is used.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
-
kmsKeyArn
↔ Output<
String?> -
ARN for the customer managed KMS key that EventBridge Scheduler will use to encrypt and decrypt your data.
latefinal
-
name
↔ Output<
String> -
Name of the schedule. If omitted, the provider will assign a random, unique name. Conflicts with
namePrefix.latefinal -
namePrefix
↔ Output<
String> -
Creates a unique name beginning with the specified prefix. Conflicts with
name.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
-
scheduleExpression
↔ Output<
String> -
Defines when the schedule runs. Read more in Schedule types on EventBridge Scheduler.
latefinal
-
scheduleExpressionTimezone
↔ Output<
String?> -
Timezone in which the scheduling expression is evaluated. Defaults to
UTC. Example:Australia/Sydney.latefinal -
startDate
↔ Output<
String?> -
The date, in UTC, after which the schedule can begin invoking its target. Depending on the schedule's recurrence expression, invocations might occur on, or after, the start date you specify. EventBridge Scheduler ignores the start date for one-time schedules. Example:
2030-01-01T01:00:00Z.latefinal -
state
↔ Output<
String?> -
Specifies whether the schedule is enabled or disabled. One of:
ENABLED(default),DISABLED.latefinal -
target
↔ Output<
ScheduleTarget> -
Configures the target of the schedule. Detailed below.
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