How to trigger a Lambda function at specific time in AWS?

删除回忆录丶 提交于 2020-12-08 06:08:08

问题


I am aware of the CloudWatch recurring events that can be used to run Lambda recurringly.. but is there a way that I can trigger it on a certain time and not repeat?


回答1:


you can provide to it a cron expression or rate. what you are looking for is the cron expression option that will let you to say when exactly to run. more info - https://docs.aws.amazon.com/lambda/latest/dg/tutorial-scheduled-events-schedule-expressions.html

if you want to run it once, manually, you can always trigger it with the "test" button at the top of the page. you can really be creative here, for example, you can even trigger it with an http request that will allow you to integrate it to whatever you want, super easily (Invoke a AWS Lambda function by a http request)




回答2:


Using cloud watch rules - a single non-repetitive date can be assigned.

Example cron : 0 10 16 6 ? 2019 min hours day month dayOfWeek year

This will execute once on Sun, 16 Jun 2019 10:00:00 GMT as an example.

Reference: https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html




回答3:


You will need to make use of cloudwatch event rules. Lambda can be triggered from the rule based on the cron expression you provide. This AWS tutorial will walk you through the setup.



来源:https://stackoverflow.com/questions/48538170/how-to-trigger-a-lambda-function-at-specific-time-in-aws

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!