简体   繁体   English

如何安排 Lambda function 仅在特定日期每天执行?

[英]How do I schedule a Lambda function to execute everyday only during specific dates?

Is there a way to schedule my Lambda to run everyday ONLY during specific dates?有没有办法安排我的 Lambda 仅在特定日期每天运行? Example:例子:

  • everyday between 1-July to 30-July 7 月 1 日至 7 月 30 日期间的每一天
  • everyday between 1-Oct to 30-Dec 10 月 1 日至 12 月 30 日期间的每天

Also, could I use these dates to set the schedule expression with eventbridge - https://docs.aws.amazon.com/eventbridge/latest/userguide/example_eventbridge_PutRule_section.html ?另外,我可以使用这些日期来设置 eventbridge 的计划表达式 - https://docs.aws.amazon.com/eventbridge/latest/userguide/example_eventbridge_PutRule_section.html吗?

You can use the below cron expression to trigger the lambda function between 1-July and to 30-July您可以使用以下 cron 表达式在 7 月 1 日至 7 月 30 日之间触发 lambda function

0 0 1-30 7 ? *

Explanation of the cron expression: cron 表达式的解释:

  • The first field is for minutes (0).第一个字段是分钟 (0)。
  • The second field is for hours (0).第二个字段是小时 (0)。
  • The third field is for days of the month (1-30).第三个字段是一个月中的几天 (1-30)。
  • The fourth field is for months (7, July).第四个字段代表月份(7 月 7 日)。
  • The fifth field is for days of the week (? means every day).第五个字段是一周中的几天(?表示每天)。
  • The sixth field is for years (* means every year).第六个字段是年份(* 表示每年)。

You can refer attached image:您可以参考附图:

事件桥 Cron 表达式配置

You can set up a rule to run an AWS Lambda function on a schedule.您可以设置规则以按计划运行 AWS Lambda function。 Here is a tutorial that shows how to do it.这是一个教程,展示了如何做到这一点。

At a high level, here are the steps.在高层次上,这里是步骤。

  1. Create an AWS Lambda Function创建一个AWS Lambda Function
  2. Create a Rule via CloudWatch通过 CloudWatch 创建规则
  3. Verify the Rule验证规则

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何安排 firebase 消息在每天的特定时间发送消息? - How can I schedule firebase messaging to send a message at a specific time everyday? 如何安排 lambda function 在另一个 lambda function 记录特定条目后运行 2 小时? - How to schedule a lambda function to run 2 hours after another lambda function logs a specific entry? 如何将特定的 AWS Lambda function 部署到特定的阶段 - How can I deploy a specific AWS Lambda function to a specific Stage 如何让gcp schedule在每小时的特定时间执行任务? - How to make gcp schedule execute tasks at a specific time every hour? 如何找到 lambda function 的端点 API? - How do I find the API endpoint of a lambda function? 如何为 Cloudfront 创建 HttpOrigin 以使用 Lambda function url? - How do I create a HttpOrigin for Cloudfront to use a Lambda function url? AWS TS CDK如何执行 Lambda function - AWS TS CDK how to execute Lambda function 如何将频率设置为每天 4 个特定时间 - How to set Frequency at 4 specific hours everyday 如何在AWS的特定时间触发Lambda function? - How to trigger a Lambda function at specific time in AWS? 如何从javascript中的另一个lambda调用特定的lambda模块function? - How to call a specific lambda module function from another lambda in javascript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM