Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invoke Lambda function on button click in React

To start I just want to say that I'm really new to AWS overall (1-2 weeks). So I might not think correct from start.

I'm working on an app where I want to click a button in JSX and trigger a Lambda function that gets data from a dynamodb table and shows it in the UI.

I'm writing the infrastructure as code using aws cdk. How should I face this? Do you have any guides that I can follow?

like image 406
gospecomid12 Avatar asked Apr 29 '26 10:04

gospecomid12


1 Answers

Welcome! Please have a look on this guide.

With AWS, it's a best practice to create an AWS API Gateway, which acts as your HTTP/HTTPS/API web server.

enter image description here

Within this API gateway, you can integrate a Lambda function with a route (e.g. GET /users), where that Lambda function grabs the data from AWS DynamoDB process it as you wish and returns the output.

To integrate it with your code, you create an HTTP GET/POST request to the API gateway URL.

like image 160
Alin Andrei Avatar answered May 04 '26 00:05

Alin Andrei



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!