{
    "Comment": "A state machine that does starts analize and stops Rekognition model.",
    "StartAt": "Start Model",
    "States": {
        "Start Model": {
            "Type": "Task",
            "Resource": "${StartModelFunctionArn}",
            "Retry": [
                {
                    "ErrorEquals": [
                        "States.TaskFailed"
                    ],
                    "IntervalSeconds": 15,
                    "MaxAttempts": 1,
                    "BackoffRate": 1.5
                }
            ],
            "Next": "Analyze Image"
        },       
        "Analyze Image": {
            "Type": "Task",
            "Resource": "${AnalyzeImageFunctionArn}",
            "Retry": [
                {
                    "ErrorEquals": [
                        "States.TaskFailed"
                    ],
                    "IntervalSeconds": 15,
                    "MaxAttempts": 2,
                    "BackoffRate": 1
                }
            ],
            "Next": "Stop Model"
        },
        "Stop Model": {
            "Type": "Task",
            "Resource": "${StopModelFunctionArn}",            
            "Retry": [
                {
                    "ErrorEquals": [
                        "States.TaskFailed"
                    ],
                    "IntervalSeconds": 20,
                    "MaxAttempts": 5,
                    "BackoffRate": 10
                }
            ],
            "End": true
        }
    }
}