简体   繁体   English

aws cron 计划从不运行

[英]aws cron schedule to run never

I have an lambda that is currently scheduled to run every monday.我有一个 lambda,目前计划每周一运行。 We have dev, test and prod environments with parameterized cloudformation templates for each.我们有开发、测试和生产环境,每个环境都有参数化的 cloudformation 模板。 I want to make it so that my lambda only triggers in prod every week and not in other envs.我想让我的 lambda 每周只在产品中触发,而不是在其他环境中触发。 How do I change the schedule for lower envs that my lambda just never executes?如何更改我的 lambda 从不执行的较低环境的时间表?

It depends on what your "Trigger" is set up as, I am assuming it is a CloudWatch EvenBridge Rule.这取决于您的“触发器”的设置方式,我假设它是 CloudWatch EvenBridge 规则。

In that case, simply go to your Lambda > "Configuration" tab > "Triggers" > and find out the Rule that you are using.在这种情况下,只需将 go 转到您的 Lambda >“配置”选项卡 >“触发器”> 并找出您正在使用的规则。 Once you are Looking at the rule from the CloudWatch Console, you can just Disable the rule.从 CloudWatch 控制台查看规则后,您可以禁用该规则。

*****Edited Below ***** *****编辑如下*****

Based on your comment, you would most likely find something along the lines of:根据您的评论,您很可能会发现以下内容:

ScheduledRule: 
  Type: AWS::Events::Rule
  Properties: 
    Description: "ScheduledRule"
    ScheduleExpression: "rate(10 minutes)"
    # State: "ENABLED" #
    Targets: 
      - 
        Arn: 
          Fn::GetAtt: 
            - "LambdaFunction"
            - "Arn"
        Id: "TargetFunctionV1"
PermissionForEventsToInvokeLambda: 
  Type: AWS::Lambda::Permission
  Properties: 
    FunctionName: !Ref "LambdaFunction"
    Action: "lambda:InvokeFunction"
    Principal: "events.amazonaws.com"
    SourceArn: 
      Fn::GetAtt: 
        - "ScheduledRule"
        - "Arn"

Note the Line I had marked with #, should be changed to "Disabled"请注意,我用# 标记的行应更改为“已禁用”

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM