- Newest
- Most votes
- Most comments
Hi,
-
you should check if you can replace the 1st lambda with an API gateway validator: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-method-request-validation.html
-
Otherwise, if you need to keep both Lambdas: use a Lambda Authorizer https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-use-lambda-authorizer.html and then call your second functional Lambda via the regular binding GTW -> Lambda
Hi,
Another option is to instead have an api gateway with an integration to a step function.
https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-api-gateway.html
It is still good practice to do validations via lambda authorizers and then invoke a step function containing as many states as lambda functions.
Hope it helps ;)
Relevant content
- Accepted Answerasked 4 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 10 months ago
Hello, Thats seems a good approach for handling one lambda function as API Gateway Authorizer, but what if I want another third lambda function to fill logging table which has to run when the main endpoint request is processed. How can I do that ? In a single Method in API Gateway ?
For your 3rd Lambda logging API activity, a common pattern is to push the log message to an Amazon SQS queue and have the 3rd Lambda receive and process those from SQS as asynchronous events. You could also log authorization activity from the 1st Lambda using the same method.