[英]How can we use AWS Kinesis in a web browser?
How can we use AWS Kinesis in a web browser? 我们如何在Web浏览器中使用AWS Kinesis?
I'm interested in AWS Kinesis Stream and wondering if I can use it to send users' activity logs directly from their browsers to AWS. 我对AWS Kinesis Stream感兴趣并想知道我是否可以使用它将用户的活动日志直接从他们的浏览器发送到AWS。
AWS provides a JavaScript SDK which is executable in a web browser but, according to its document, the SDK requires credential information because of which, I think, it's not secure to use it in my use case. AWS提供了一个可在Web浏览器中执行的JavaScript SDK ,但根据其文档,SDK需要凭据信息,因此,我认为在我的用例中使用它是不安全的。
Should I put proxy servers between their browsers and AWS Kinesis? 我应该在他们的浏览器和AWS Kinesis之间放置代理服务器吗? Or is there any secure way to use AWS Kinesis in such a case?
或者在这种情况下是否有使用AWS Kinesis的安全方法?
You have couple of options to use the JS SDK directly from the browsers of your users without embedding credentials in your code or force your users to log in into a service: 您可以直接从用户的浏览器中使用JS SDK,而无需在代码中嵌入凭据或强制用户登录服务:
The first one is to use AWS Cognito . 第一个是使用AWS Cognito 。 You can embed couple of line of code in your JS code that will identify the identity pool you want to use.
您可以在JS代码中嵌入几行代码,以识别您要使用的标识池。 On the service side you define the role for unauthenticated users to be able to write to Kinesis.
在服务端,您可以定义未经身份验证的用户可以写入Kinesis的角色。 You can see more details in this blog post: https://blogs.aws.amazon.com/javascript/post/Tx1F7FO6GDAIXD3/Authentication-with-Amazon-Cognito-in-the-Browser
您可以在此博客文章中查看更多详细信息: https : //blogs.aws.amazon.com/javascript/post/Tx1F7FO6GDAIXD3/Authentication-with-Amazon-Cognito-in-the-Browser
The second option is to put API-Gateway between your users and the Kinesis stream. 第二个选项是在用户和Kinesis流之间放置API-Gateway 。 The gateway is a managed service that you can define as "open" with no authentication and the gateway can be the one with the permission to write to your Kinesis stream.
网关是一种托管服务,您可以将其定义为“打开”而不进行身份验证,网关可以是具有写入Kinesis流的权限的网关。 The simplest way is to use a Lambda function that will be able also to transform/clean the events before putting them to the stream.
最简单的方法是使用Lambda函数,该函数在将事件放入流之前也能够转换/清除事件。 See more details in the service documentations: http://docs.aws.amazon.com/apigateway/latest/developerguide/getting-started.html
请参阅服务文档中的更多详细信息: http : //docs.aws.amazon.com/apigateway/latest/developerguide/getting-started.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.