You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(scheduler): base target methods and lambda invoke target (#26575)
This PR contains implementation for Schedule Targets:
1. Creates a separate module for targets
2. Support imported resources, but not cross account, cross region resources as we discussed in RFC. The unit tests should cover 4 cases (target and role within the same stack, target is imported, role is imported, target and role are imported),
3. I have moved out class `Schedule` from private package to depend on it in `schedule-targets` unit tests.
Implementation is based on RFC: https://github.com/aws/aws-cdk-rfcs/blob/master/text/0474-event-bridge-scheduler-l2.md
Advances #23394
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Copy file name to clipboardExpand all lines: packages/@aws-cdk/aws-scheduler-alpha/README.md
+77-27
Original file line number
Diff line number
Diff line change
@@ -37,16 +37,21 @@ This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aw
37
37
38
38
## Defining a schedule
39
39
40
-
TODO: Schedule is not yet fully implemented. See section in [L2 Event Bridge Scheduler RFC](https://github.com/aws/aws-cdk-rfcs/blob/master/text/0474-event-bridge-scheduler-l2.md)
41
-
42
-
[comment]: <>(TODO: change for each PR that implements more functionality)
40
+
```ts
41
+
declareconst fn:lambda.Function;
43
42
44
-
Only an L2 class is created that wraps the L1 class and handles the following properties:
43
+
const target =newtargets.LambdaInvoke(fn, {
44
+
input: ScheduleTargetInput.fromObject({
45
+
"payload": "useful",
46
+
}),
47
+
});
45
48
46
-
- schedule
47
-
- schedule group
48
-
- target (only LambdaInvoke is supported for now)
49
-
- flexibleTimeWindow will be set to `{ mode: 'OFF' }`
TODO: Scheduler Targets Module is not yet implemented. See section in [L2 Event Bridge Scheduler RFC](https://github.com/aws/aws-cdk-rfcs/blob/master/text/0474-event-bridge-scheduler-l2.md)
130
-
131
-
Only LambdaInvoke target is added for now.
134
+
The `@aws-cdk/aws-schedule-targets-alpha` module includes classes that implement the `IScheduleTarget` interface for
135
+
various AWS services. EventBridge Scheduler supports two types of targets: templated targets invoke common API
136
+
operations across a core groups of services, and customizeable universal targets that you can use to call more
137
+
than 6,000 operations across over 270 services. A list of supported targets can be found at `@aws-cdk/aws-schedule-targets-alpha`.
TODO: Not yet implemented. See section in [L2 Event Bridge Scheduler RFC](https://github.com/aws/aws-cdk-rfcs/blob/master/text/0474-event-bridge-scheduler-l2.md)
165
+
An execution role is an IAM role that EventBridge Scheduler assumes in order to interact with other AWS services on your behalf.
166
+
167
+
The classes for templated schedule targets automatically create an IAM role with all the minimum necessary
168
+
permissions to interact with the templated target. If you wish you may specify your own IAM role, then the templated targets
169
+
will grant minimal required permissions. For example: for invoking Lambda function target `LambdaInvoke` will grant
170
+
execution IAM role permission to `lambda:InvokeFunction`.
@@ -168,7 +195,30 @@ TODO: Not yet implemented. See section in [L2 Event Bridge Scheduler RFC](https:
168
195
169
196
## Error-handling
170
197
171
-
TODO: Not yet implemented. See section in [L2 Event Bridge Scheduler RFC](https://github.com/aws/aws-cdk-rfcs/blob/master/text/0474-event-bridge-scheduler-l2.md)
198
+
You can configure how your schedule handles failures, when EventBridge Scheduler is unable to deliver an event
199
+
successfully to a target, by using two primary mechanisms: a retry policy, and a dead-letter queue (DLQ).
200
+
201
+
A retry policy determines the number of times EventBridge Scheduler must retry a failed event, and how long
202
+
to keep an unprocessed event.
203
+
204
+
A DLQ is a standard Amazon SQS queue EventBridge Scheduler uses to deliver failed events to, after the retry
205
+
policy has been exhausted. You can use a DLQ to troubleshoot issues with your schedule or its downstream target.
206
+
If you've configured a retry policy for your schedule, EventBridge Scheduler delivers the dead-letter event after
207
+
exhausting the maximum number of retries you set in the retry policy.
0 commit comments