I am new to AWS and plan to use Angular to make http request to endpoints to access DynamoDB. I am not sure which option to use since I see there is 1. Dynamodb's web services 2. use API Gateway to call lambda that call dynamodb. Could someone help me to understand what is the preferred method to access dynamodb from a front-end framework and why? Thank you!
1 Answer
It's not good idea to call DynamoDB from Angular(JavaScript). It doesn't comes under the AWS best practices. The reason is you have to hard code the AccessKey and SecretKey in your Javascript file. If it's a project need you can use Amazon Cognito instead.
Better you can use the Lambda and API Gateway. Invoke the API Gateway endpoint from your Angular file which in background will trigger the Lambda function which has the code Call the DynamoDB Table and return back the results. The below link explains the Process.
1 Comment
F_SO_K
You can call DynamoDB from Javascript without hard coding your keys in a file. You can use Cognito tokens instead docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/…