I'm building a proof-of-concept UI served as a static JS application (just free static hosting on Netlify), and I'd like to be able to read and write data to a NoSQL database.
As it's a PoC, I need to keep it 100% free. The request rate will be super low; only a few people will ever see it. DynamoDB seems like a good choice for size and cost ($0).
So what's the simplest possible way to read/write data from DynamoDB from a browser client? It's hard to tell what's absolutely necessary. Ideally I'd connect directly to the database (no API gateway, no lambdas), while maintaining some kind of baseline security.
You can query dynamodb from your browser using aws sdk for browser,
you will need to carefully create a IAM user with limited access (eg. no updateTable perms etc. )
Keep in mind that anyone could hijack your access keys and increase the throughput and generate cost ( if they have updateTable priv. ) or query your tables outside of your website and consume all the available capacity.
I would still go with API gateway / lambda
There is no need for API gateway / lambda for simple DynamoDB requests. I would suggest to use AWS Cognito with the AWS Amplify Auth Library to get access to the DynamoDB. Then use a client like Dynamo-Easy which has some nice abstraction, so you can jump start your dev without learning the low level of the DynamoDB JS client from AWS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With