是否可以从CloudWatch为Lambda状态函数集创建计划规则

时间:2017-06-13 15:17:48

标签: amazon-web-services amazon-cloudformation amazon-cloudwatch aws-step-functions

我想使用CloudFormation按计划(30分钟)使用步骤函数在状态机中创建一堆预先存在的Lambda函数。我已成功为其他方法创建了堆栈。

从本质上讲,我需要有关如何在CloudFormation for Step Functions 中创建预定事件的帮助或指导。这是我一直在尝试的:

"NOTDScheduler": {
        "Type": "AWS::Events::Rule",
        "Properties": {
            "Description": "Schedules a NOTD every 30 minutes",
            "ScheduleExpression": "rate(30 minutes)",
            "State": "ENABLED",
            "Targets": [
                {
                    "Arn": "${statemachineARN}",
                    "statemachineARN": {
                        "Fn::GetAtt": [
                            "NOTDStateMachine",
                            "Arn"
                        ]
                    },
                    "Id": "NOTDScheduleTarget"
                }
            ]
        },

但我不断收到错误,例如

  

[Error] / Resources / NOTDScheduler / Properties / Targets / 0 / statemachineARN / Fn :: GetAtt:资源类型AWS :: StepFunctions :: StateMachine不支持属性{Arn}。

并且不知道Arn不是受支持的属性。有解决方法吗?

1 个答案:

答案 0 :(得分:6)

要获取AWS::StepFunctions::StateMachine资源的ARN,您需要致电!Ref NOTDStateMachine而不是!GetAtt NOTDStateMachine.Arn

点击此处Return Valueshttp://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html