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

J. *_*doe 8 amazon-web-services aws-cloudformation amazon-cloudwatch aws-step-functions

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

本质上,我需要有关如何在CloudFormation中为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"
                }
            ]
        },
Run Code Online (Sandbox Code Playgroud)

但我不断收到诸如

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

而且不知道Arn如何不支持的属性。有解决方法吗?

Mai*_*KaY 7

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

Return Values在此处检查:http : //docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html