AWSTemplateFormatVersion: "2010-09-09" Transform: AWS::Serverless-2016-10-31 Description: > Request response Sample SAM Template for simple retry Resources: WaitForCallbackStateMachine: Type: AWS::Serverless::StateMachine Properties: DefinitionUri: statemachine/statemachine.asl.json DefinitionSubstitutions: topicArn: !Ref SNSTopic SQSQueue: !Ref SQSQueue Policies: - SNSPublishMessagePolicy: TopicName: !GetAtt SNSTopic.TopicName - SQSSendMessagePolicy: QueueName: !GetAtt SQSQueue.QueueName SQSQueue: Type: 'AWS::SQS::Queue' Properties: DelaySeconds: 0 VisibilityTimeout: 30 RedrivePolicy: deadLetterTargetArn: !GetAtt [SQSQueueDLQ, Arn] maxReceiveCount: 1 SQSQueueDLQ: Type: 'AWS::SQS::Queue' Properties: DelaySeconds: 0 VisibilityTimeout: 30 SNSTopic: Type: 'AWS::SNS::Topic' Properties: DisplayName: 'StepFunctionsTemplate-CallbackTopic' LambdaFunctionCallbackWithTaskToken: Type: AWS::Serverless::Function Properties: Role: !GetAtt LambdaExecutionRole.Arn CodeUri: CallbackWithTaskToken/function/ Handler: app.lambdaHandler Runtime: nodejs14.x Timeout: 3 Events: SQSEvent: Type: SQS Properties: Queue: !GetAtt SQSQueue.Arn BatchSize: 10 Enabled: true LambdaExecutionRole: Type: "AWS::IAM::Role" Properties: AssumeRolePolicyDocument: Version: "2012-10-17" Statement: - Effect: Allow Principal: Service: lambda.amazonaws.com Action: "sts:AssumeRole" Policies: - PolicyName: StatesExecutionPolicy PolicyDocument: Version: "2012-10-17" Statement: - Effect: Allow Action: - "states:sendTaskSuccess" Resource: !Ref WaitForCallbackStateMachine Outputs: WaitForCallbackStateMachine: Description: "state machine ARN" Value: !Ref WaitForCallbackStateMachine