public async Task Can_be_invoked_from_step_functions_local() { // 1. Create the StepFunctions Client var credentials = new BasicAWSCredentials("not", "used"); var config = new AmazonStepFunctionsConfig { ServiceURL = _stepFunctionsServiceUrl.ToString() }; var client = new AmazonStepFunctionsClient(credentials, config); // 2. Create step machine with a single task the invokes a lambda function // The FunctionName contains the lambda to be invoked. var request = new CreateStateMachineRequest { Name = "Foo", Type = StateMachineType.STANDARD, Definition = @"{ ""Comment"": ""A Hello World example demonstrating various state types of the Amazon States Language"", ""StartAt"": ""Invoke Lambda function"", ""States"": { ""Invoke Lambda function"": { ""Type"": ""Task"", ""Resource"": ""arn:aws:states:::lambda:invoke"", ""Parameters"": { ""FunctionName"": ""arn:aws:lambda:us-east-1:123456789012:function:SimpleLambdaFunction:$LATEST"", ""Payload"": { ""Input.$"": ""$.Payload"" } }, ""End"": true } } }" }; var createStateMachineResponse = await client.CreateStateMachineAsync(request); // 3. Create a StepFunction execution. var startExecutionRequest = new StartExecutionRequest { Name = Guid.NewGuid().ToString(), StateMachineArn = createStateMachineResponse.StateMachineArn, Input = @"{ ""Payload"": { ""Foo"": ""Bar"" } }" }; var startExecutionResponse = await client.StartExecutionAsync(startExecutionRequest); var getExecutionHistoryRequest = new GetExecutionHistoryRequest { ExecutionArn = startExecutionResponse.ExecutionArn, IncludeExecutionData = true, }; // 4. Poll and wait for the while (true) { var getExecutionHistoryResponse = await client.GetExecutionHistoryAsync(getExecutionHistoryRequest); var historyEvent = getExecutionHistoryResponse.Events.Last(); if (historyEvent.ExecutionSucceededEventDetails != null) { _outputHelper.WriteLine("Execution succeeded"); _outputHelper.WriteLine(historyEvent.ExecutionSucceededEventDetails.Output); break; } if (historyEvent.ExecutionFailedEventDetails != null) { _outputHelper.WriteLine("Execution failed"); _outputHelper.WriteLine(historyEvent.ExecutionFailedEventDetails.Cause); break; } } }