简体   繁体   English

如何从 s3 存储桶读取数据到 Kinesis Stream

[英]How to read data from s3 bucket to Kinesis Stream

I am new to Kinesis.我是 Kinesis 的新手。 I want to read data from s3 bucket to Kinesis stream.我想从 s3 存储桶读取数据到 Kinesis stream。 I have created a kinesis stream called 'mystream'.我创建了一个名为“mystream”的运动 stream。 In my project every 3 month a record will be uploaded to the s3.在我的项目中,每 3 个月将有一条记录上传到 s3。 At the same time I need to read the record to kinesis stream.同时我需要读取kinesis stream的记录。 I have created Lamda for reading the file and save it into the RDS DB instance.我创建了 Lamda 来读取文件并将其保存到 RDS 数据库实例中。 I found in lambda project there is one kinesis event.我在 lambda 项目中发现有一个运动事件。 Is this the way to do the thing?这是做这件事的方法吗? please help me to get this.请帮我得到这个。 I don't know how to start it and all.. It would be great if some one can help me....我不知道如何开始它和所有..如果有人可以帮助我会很棒....

If my understanding is right your question is about how to write s3 object data into kinesis.如果我的理解是正确的,您的问题是关于如何将 s3 对象数据写入 kinesis。

You can create an event Notification in S3 for lambda.您可以在 S3 中为 lambda 创建事件通知。 In events, you can select the event (ObjectCreate (All), put, post).在事件中,您可以选择事件(ObjectCreate (All)、put、post)。 After Successful creation for each object create action you get notifications in lambda.为每个对象创建操作成功创建后,您会在 lambda 中收到通知。 In lambda event context you get the s3 object information of each invocation.在 lambda 事件上下文中,您可以获得每次调用的 s3 对象信息。

Now you can read about the object information and write it in kinesis stream.现在您可以阅读对象信息并将其写入 kinesis 流。

Links for AWS S3 and Kinesis Stream using Java使用 Java 的 AWS S3 和 Kinesis Stream 的链接

https://docs.aws.amazon.com/AmazonS3/latest/dev/RetrievingObjectUsingJava.html https://docs.aws.amazon.com/AmazonS3/latest/dev/RetrievingObjectUsingJava.html

https://docs.aws.amazon.com/streams/latest/dev/developing-producers-with-sdk.html https://docs.aws.amazon.com/streams/latest/dev/developing-producers-with-sdk.html

With the AWS SDK release, you may need to change the way you're reading the S3 file into your Lambda function.对于 AWS SDK 版本,您可能需要更改将 S3 文件读入 Lambda function 的方式。 The contents now come back as a stream:内容现在以 stream 的形式返回:

https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html#API_GetObject_ResponseSyntax https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html#API_GetObject_ResponseSyntax

You can stream the data into your Lambda: https://carova.io/snippets/read-data-from-aws-s3-with-nodejs您可以将 stream 的数据放入您的 Lambda: https://carova.io/snippets/read-data-from-aws-s3-with-nodejs

Then inside your Lambda Function, push the contents into Kinesis Pushing AWS Lambda data to Kinesis Stream然后在您的 Lambda Function 中,将内容推送到 Kinesis 将 AWS Lambda 数据推送到 Kinesis ZEAE835E83C04494A3769229F2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM