The CDK Construct Library for Amazon Scheduler Targets
Project description
Amazon EventBridge Scheduler Construct Library
---The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.
Amazon EventBridge Scheduler is a feature from Amazon EventBridge that allows you to create, run, and manage scheduled tasks at scale. With EventBridge Scheduler, you can schedule one-time or recurrently tens of millions of tasks across many AWS services without provisioning or managing underlying infrastructure.
This library contains integration classes for Amazon EventBridge Scheduler to call any number of supported AWS Services.
The following targets are supported:
targets.LambdaInvoke
: Invoke an AWS Lambda function)
Invoke a Lambda function
Use the LambdaInvoke
target to invoke a lambda function.
The code snippet below creates an event rule with a Lambda function as a target called every hour by Event Bridge Scheduler with custom payload. You can optionally attach a dead letter queue.
import aws_cdk.aws_lambda as lambda_
fn = lambda_.Function(self, "MyFunc",
runtime=lambda_.Runtime.NODEJS_LATEST,
handler="index.handler",
code=lambda_.Code.from_inline("exports.handler = handler.toString()")
)
dlq = sqs.Queue(self, "DLQ",
queue_name="MyDLQ"
)
target = targets.LambdaInvoke(fn,
dead_letter_queue=dlq,
max_event_age=Duration.minutes(1),
retry_attempts=3,
input=ScheduleTargetInput.from_object({
"payload": "useful"
})
)
schedule = Schedule(self, "Schedule",
schedule=ScheduleExpression.rate(Duration.hours(1)),
target=target
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for aws-cdk.aws-scheduler-targets-alpha-2.99.1a0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a65e140ecac7cc773d41681e1bdfaacb7c0b10569b92df8ce83f554d9ace3b6f |
|
MD5 | 6e22e3f1a965fa843dbb1c6514d1aaf0 |
|
BLAKE2b-256 | ac1907238b2833c0739542a3f4616b316ded3ea24c3954ef94884ec7d76567c0 |
Hashes for aws_cdk.aws_scheduler_targets_alpha-2.99.1a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05caca67b02db4125d8de7b75ff7fa5d650455ec70a03cf798554ee37384f773 |
|
MD5 | ade3af43ee8d77d0017f34a2999bf382 |
|
BLAKE2b-256 | ca2d8451decc9616499da51c3f412a157da744b165ee220301816b7907180ae0 |