1

I am trying to do a simple event driven process utilizing AWS lambda and step functions.

When a user clicks a button in react app, I want it to trigger my AWS lambda function. My lambda function uses google sheets to configure a JSON. I am just trying to sync click event to trigger lambda function.

Not sure if the solution is an API Gateway, which seems unnecessary if I'm just trying to trigger a lambda from a web event and not read any data. Eventually, based on who is clicking the button (after login), a different lambda path is taken.

1 Answer 1

1

there are only 3 ways for you to do this: 1. you are authenticated via AWS Cognito and configured Cognito so that you can assume an IAM role to trigger the lambda (You alway need an IAM role to trigger a lambda directly) and then you use @aws-sdk/lambda-client or... you hide that lambda behind an API, like every webaapp ever. So, you can either make a REST request to API Gateway, that will trigger the lambda on your behalf, or you can use AppSync for the same thing, if you would rather use GraphQL instead of REST.

But no. There is no easy way to set up an integration between your UI and a lambda. Like you said, you want to be event-driven, but pressing a button in your own app alone is not an AWS event

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

1 Comment

please let me know how to make lambda trigger only when authentication is complete on cognito @KamilJanowski

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.