eddmann / serverless-fargate

Maintain long-running Fargate ECS tasks within your Serverless project
52 stars 22 forks source link

Support for EventBridge AWS::Scheduler::Schedule instead of AWS::Event::Rule #46

Open vinibs opened 1 year ago

vinibs commented 1 year ago

Hi! I am setting up a project to configure multiple Fargate instances, all of them scheduled, and was wondering if the plugin has already the ability to schedule the Fargate instance using the AWS::Scheduler::Schedule resource instead of the default AWS::Event::Rule. I saw on Serverless docs that they have a section about how to do it for a Lambda, however I don't think it would apply to the Fargate created through this plugin.

Is that already possible? If so, how can I do it? It's my first experience using Serverless and this plugin, so I may be just missing something, but I would really appreciate any help.

Thanks in advance.

adminy commented 8 months ago

Its possible to borrow the code from serverless:

https://github.com/serverless/serverless/blob/main/lib/plugins/aws/package/compile/events/schedule.js#L203-L292

and put it instead of this:

https://github.com/eddmann/serverless-fargate/blob/main/src/compiler.js#L149-L179

eddmann commented 3 months ago

This is an interesting idea, how would you feel about a similar API?

schedule:
     method: scheduler
     rate:
       - cron(0 0/4 ? * MON-FRI *)
     timezone: America/New_York