Home > Net >  How to curl an endpoint on a schedule with AWS
How to curl an endpoint on a schedule with AWS

Time:12-08

I'm trying to call a public API endpoint daily on a schedule from AWS. So how I would do this back in the day on a plain old server would be:

cron(0 0 * * ? *)   curl someurl.com/endpoint

In my crontab. How is the best way to go about this in the new serverless world on AWS? I've looked at Eventbridge but I can't see what kind of event target I need. Should I write a lambda that calls the endpoint? That seems like overkill.

CodePudding user response:

Eventbridge supports API destinations. With this option EventBridge invokes the HTTP endpoint and delivers the event as a payload within the request. You can use any preferred HTTP method, such as GET or POST.

Of course, you can configure the pattern as a crontab.

On Eventbridge console select Target as "API destination":

enter image description here


Reference:

https://aws.amazon.com/blogs/compute/using-api-destinations-with-amazon-eventbridge/

CodePudding user response:

SNS as the target for Eventbridge may be what you're looking for.

SNS topics can have HTTP & HTTPS endpoints as subscribers so this could solve your problem without the need for a Lambda function.

  • Related