Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scheduled rest requests from aws

I need to call some endpoint of my application periodically. I understand that i can create aws lambda function that will be triggered by aws trigger and that lambda will call my rest endpoint. Can aws lambda be avoided here? In other words, is it possible to make aws trigger to call my rest endpoint instead of aws lambda function?

like image 928
YuriR Avatar asked Apr 30 '17 11:04

YuriR


2 Answers

Things that could trigger a REST endpoint:

  • A script/application on an Amazon EC2 instance, triggered by a cron schedule
  • An AWS Lambda function triggered by an Amazon CloudWatch Events schedule
  • An Amazon Simple Notification Service (SNS) topic with your REST endpoint as a subscriber, triggered by an Amazon CloudWatch Events schedule

For the SNS option, you won't have much control over the content of the call but it can call an endpoint.

like image 175
John Rotenstein Avatar answered Nov 01 '22 23:11

John Rotenstein


Since this is still one of the top search results for these terms, this question deserves a 2021 update.

John's answer was comprehensive at the time he wrote it, but nowadays you don't have to jump through the same silly hoops as you used to. Now you can set up an EventBridge "rule" that triggers on a "cron" schedule, and that rule can have an "API Destination" target that provides a URL and an associated "Connection," which specifies things like authentication methods.

This can be set up in the console or via CloudFormation, and should be the simplest way to set up periodic calls to REST endpoints in the majority of cases.

like image 21
GrandOpener Avatar answered Nov 01 '22 23:11

GrandOpener