Skip to content

Events: cannot specify timezone for Schedule cron #21181

@maxhayward

Description

@maxhayward

Describe the feature

In the console, when creating a Rule with an Event schedule, I have the option to use UTC or 'Local time zone'.

I can't seem to find a way of specifying this in CDK. It would be helpful if this is possible.

Here's my current implementation - if there's something I can add to this, that would be great.

const rule = new Rule(this.parent, `${this.stackName}-Rule-${ruleName}`, {
      ruleName: `${this.stackName}-${ruleName}`,
      schedule: Schedule.cron({
        minute: "0",
        hour: "8,20",
      }),
    });

Use Case

For timezones such as Europe/London, currently if I want the schedule to be consistent all year around I need to manually update this field in the console after creating the Rule via CDK.

Proposed Solution

An additional field, timeZone or similar.

const rule = new Rule(this.parent, ${this.stackName}-Rule-${ruleName}, {
ruleName: ${this.stackName}-${ruleName},
schedule: Schedule.cron({
minute: "0",
hour: "8,20",
timeZone: "Europe/London"
}),
});

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.32.0

Environment details (OS name and version, etc.)

MacOS Monterey 12.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-eventsRelated to CloudWatch Eventseffort/smallSmall work item – less than a day of effortfeature-requestA feature should be added or improved.p1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions