1

I am trying to orchestrate UI calls using step function with the minimal impact. Currently I have a lambda function that can be called using different URLs via API gateway, for instance, following URLs are used to call the same lambda:

http://base.url/orders/get/order/{userid}
http://base.url/orders/get/allorders/

I know that it isn't a best practice for lambdas, but we have what we have. Now I need to add a step function between API gateway and lambda to orchestrate calls. I need step function to be able to call step function using these urls, but I cannot understand how to do that.

Here are some links that I already checked:

Is there a way to do what I need to do?

1 Answer 1

2

It sounds like you just need to format the message to the lambda in a way that looks like what would be coming from the API Gateway. If that's the case you can see what an API Gateway request would look like by selecting Amazon API Gateway AWS Proxy from the lambda test events in the console. From there you should be able to modify the payload to match your needs.

Sign up to request clarification or add additional context in comments.

4 Comments

It seems you are right! By the way, can I do AWS Proxy on the Step Function level? I will still be calling step function via Gateway, would be nice to simply forward all the info to the lambda.
I'm not sure what you're asking. If you are asking if you can call an API Gateway via Step Functions, the answer is yes (docs.aws.amazon.com/step-functions/latest/dg/…). If you are asking if you can skip that and go straight to the Lambda, the answer to that is also yes, and that's what I was describing.
Sorry for confusion. I am going to call StartSyncExecution of Step Function via API Gateway and then call Lambda from StepFunction. I am trying to understand how can I make a Lambda call in a way that Lambda would not know it is called by StepFunction, so the call should look like it comes from API Gateway. How do I pass all the parameters needed?
I tried to pass resource route from GW into StepFunction as an input like this: "RequestParameters": { "Input": "$context.resourcePath", "StateMachineArn": { "Ref": "MyStepFunctionARN" } } , so I can use it later to call lambda, but it fails validation step. I am just trying to implement your initial suggestion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.