-
Notifications
You must be signed in to change notification settings - Fork 4.5k
(aws-scheduler-targets-alpha): Add SnsPublish Target #27459
Description
Describe the feature
Work to support L2 constructs for AWS Scheduler is in progress (#23394). See the approved RFC. RFC planned to add 12 templates targets, but only Lambda Invoke is currently implemented (#26575).
This issue tracks implementation of SnsPublish target to publish a message to a SNS topic.
Use Case
Customers would like to use templated target SnsPublish to be able to publish a message to a SNS topic. on schedule. L2 target construct should grant required permissions to the AWS Scheduler to publish a message to a SNS topic.
Proposed Solution
The proposed solution needs to be adopted to the recent examples of LambdaInvoke (https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-scheduler-targets-alpha/lib/lambda-invoke.ts).
Solution should also include unit and integration tests.
export class SnsPublish extends ScheduleTargetBase {
constructor(
private readonly topic: sns.ITopic,
private readonly props: ScheduleTargetBaseProps,
) {
super(props, topic.topicArn);
}
protected addTargetActionToRole(role: iam.IRole): void {
// TODO: Check if target and schedule are in the same account and region
// TODO: Check if target and role are in the same account
this.topic.grantPublish(role);
}
}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.99.1
Environment details (OS name and version, etc.)
MacOS