How can we use AWS Kinesis in a web browser?

How can we use AWS Kinesis in a web browser?

I'm interested in AWS Kinesis Stream and I wonder if I can use it to send user activity logs directly from my browsers to AWS.

AWS provides a JavaScript SDK that is executable in a web browser, but according to its document, the SDK requires credentials, which is why, I think, it is not secure to use in my use case.

Should I install proxies between their browsers and AWS Kinesis? Or is there a safe way to use AWS Kinesis in this case?

+5
source share
1 answer

You have several options for using the JS SDK directly from the browsers of your users, without pasting credentials into your code or without forcing users to enter the service:

The first of these is the use of AWS Cognito . You can insert a couple lines of code into your JS code that identifies the identifier pool you want to use. On the service side, you define the role that unauthorized users can write to 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

The second option is to put an API Gateway between your users and the Kinesis stream. A gateway is a managed service that you can define as β€œopen” without authentication, and the gateway may be someone who has permission to write to your Kinesis stream. The easiest way is to use the Lambda function, which will also be able to transform / clear events before putting them into the stream. For more information, see the service docs: http://docs.aws.amazon.com/apigateway/latest/developerguide/getting-started.html

+6
source

Source: https://habr.com/ru/post/1247007/


All Articles