用Angular访问dynamodb [英] Access dynamodb with Angular

查看:135
本文介绍了用Angular访问dynamodb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是AWS的新手,并计划使用Angular向端点发出http请求以访问DynamoDB。我不确定该使用哪个选项,因为我看到有1个。Dynamodb的Web服务。2.使用API​​网关调用称为dynamodb的lambda。有人可以帮助我了解从前端框架访问dynamodb的首选方法是什么,为什么?谢谢!

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!

推荐答案

从Angular(JavaScript)调用DynamoDB并不是一个好主意。它不受AWS最佳实践的约束。原因是您必须在Javascript文件中对 AccessKey SecretKey 进行硬编码。如果项目需要,您可以使用Amazon Cognito。

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.

更好的是,您可以使用Lambda和API网关。从您的Angular文件中调用API Gateway端点,该文件在后台将触发Lambda函数,该函数具有代码Call DynamoDB Table并返回结果。以下链接说明了该过程。

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.

前端=> API网关=> Lambda => DynamoDB

这篇关于用Angular访问dynamodb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆