aws-samples / aws-stepfunctions-examples

AWS Step Functions is an orchestration service for reliably executing multi-step processes using visual workflows. This repository includes detailed examples that will help you unlock the power of serverless workflow.
MIT No Attribution
226 stars 86 forks source link

[New sample] API Gateway -> SF -> Lambda #10

Open zachjonesnoel opened 2 years ago

zachjonesnoel commented 2 years ago

Can there be a pattern which uses SF invoked via API Gateway which checks if the concurrency limit of Lambda is exceeded or not and if not exceed invoke Lambda.

The background being, I'm trying to invoke a Lambda which can hit concurrency limit of 1k and I'm trying to solution if SF can check if Lambda is under concurrency cap or not and if not, invoke it else queue it.

JustinCallison commented 2 years ago

@zachjonesnoel Thanks for your suggestion. Would love to see more examples with API-G and Sync Express for sure.

On this one though, I'd like to learn more about your case. I don't know that there's any way to check proactively what the concurrency limit is before calling Lambda, nor would I recommend it. Since you can't know proactively what you will get when you actually call.

That said, with Step Functions you can call Lambda and handle the exception if concurrency is exceeded, then choose to drop the request into a queue etc. Is that what you are looking to do?