能够在 Amazon CloudWatch Events 规则中指定唯一参数
Ability to specify unique parameters in an Amazon CloudWatch Events rule
AWS::Events::Rule 可以有参数吗?让您拥有运行相同代码的不同计划规则,但您想要一个参数作为输入,以便您可以区分触发了哪个规则?
ScheduledRule1:
Type: AWS::Events::Rule
Properties:
Description: Scheduled Rule
ScheduleExpression: "rate(5 minutes)"
State: "ENABLED"
Targets:
- Id: "MyJob"
Arn: !GetAtt MyJob.Arn
ScheduledRule2:
Type: AWS::Events::Rule
Properties:
Description: Scheduled Rule
ScheduleExpression: "rate(60 minutes)"
State: "ENABLED"
Targets:
- Id: "MyJob"
Arn: !GetAtt MyJob.Arn
是的。
指定目标时,您可以提供一个常量来帮助识别哪个规则触发了 AWS Lambda 函数。
这是在 Amazon CloudWatch Events 控制台中:
在 CloudFormation 中,这将通过 Target
部分中的 Input
参数设置。
AWS::Events::Rule 可以有参数吗?让您拥有运行相同代码的不同计划规则,但您想要一个参数作为输入,以便您可以区分触发了哪个规则?
ScheduledRule1:
Type: AWS::Events::Rule
Properties:
Description: Scheduled Rule
ScheduleExpression: "rate(5 minutes)"
State: "ENABLED"
Targets:
- Id: "MyJob"
Arn: !GetAtt MyJob.Arn
ScheduledRule2:
Type: AWS::Events::Rule
Properties:
Description: Scheduled Rule
ScheduleExpression: "rate(60 minutes)"
State: "ENABLED"
Targets:
- Id: "MyJob"
Arn: !GetAtt MyJob.Arn
是的。
指定目标时,您可以提供一个常量来帮助识别哪个规则触发了 AWS Lambda 函数。
这是在 Amazon CloudWatch Events 控制台中:
在 CloudFormation 中,这将通过 Target
部分中的 Input
参数设置。