在一个指定的未来时间仅调用一次AWS Lambda函数 [英] Invoke AWS Lambda function only once, at a single specified future time

查看:68
本文介绍了在一个指定的未来时间仅调用一次AWS Lambda函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够设置一个时间来调用AWS Lambda函数,然后让该函数仅在那时才被调用。例如,我希望我的Lambda函数在2017年12月19日晚上9:00运行。我不希望它重复,我不希望它现在在19日晚上9:00运行。

I want to be able to set a time to invoke an AWS Lambda function, then have that function be invoked then and only then. For example, I want my Lambda function to run at 9:00pm on December 19th, 2017. I don't want it to repeat, I don't want it to invoke now, just at 9:00pm on the 19th.

我了解CloudWatch提供了计划的事件,并且我在想,当输入安排该提醒的时间时,会创建一个CloudWatch的计划事件来触发从现在开始的时间(例如,如果您将其安排在晚上8:22 pm运行到晚上9点,则将是38分钟),那么它将在晚上9点调用Lambda函数,然后删除CloudWatch Scheduled Event。我的问题是,当创建CloudWatch Scheduled Event时,它将立即在指定的时间间隔执行。

I understand that CloudWatch provides Scheduled Events, and I was thinking that when a time to schedule this reminder for is inputted, a CloudWatch Scheduled Events is created to fire in that amount of time from now (so like if you schedule it at 8:22pm to run at 9pm, it’ll be 38 mins), then it invokes the Lambda function at 9pm which then deletes the CloudWatch Scheduled Event. My issue with this is that when a CloudWatch Scheduled Event is created, it executes right then, then at the specified interval.

其他任何想法,我都可以理解没有想到另一种解决方案。

Any other ideas would be appreciated, as I can't think of another solution. Thanks in advance!

推荐答案

您可以使用以下语法安排lambda事件:

You can schedule lambda event using following syntax:

cron(星期几,每月的分钟数)

注意:所有字段均为必填字段,时区仅为UTC时间

Note: All fields are required and time zone is UTC only

请参阅此 AWS文档了解详情。

谢谢

这篇关于在一个指定的未来时间仅调用一次AWS Lambda函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆