8
votes

I want to use CloudFormation to create a stack of preexisting Lambda Functions into a State Machine using Step Functions on a schedule (30 mins). I have successfully created the stack for my other methods.

In essence, I need help or guidance on how to create a scheduled event in CloudFormation for Step Functions. Here is what I have been trying:

"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"
                }
            ]
        },

But I keep getting errors such as

[Error] /Resources/NOTDScheduler/Properties/Targets/0/statemachineARN/Fn::GetAtt: Resource type AWS::StepFunctions::StateMachine does not support attribute {Arn}.

and have no clue how Arn isnt a supported attribute. Is there a workaround?

1

1 Answers

8
votes

To get the ARN of a AWS::StepFunctions::StateMachine resource you need to call !Ref NOTDStateMachine instead of !GetAtt NOTDStateMachine.Arn

Check Return Values here: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html