我们可以编写一个AWS Lambda函数来查询Kinesis Streams吗

问题描述:

我有Amazon Kinesis Streams,其中包含所有点击流数据,我们想编写一个API来查询Kinesis Streams.

I have Amazon Kinesis Streams, which has all the click stream data and we want to write an API to query Kinesis Streams.

我的计划是创建一个API网关,该网关调用一个AWS Lambda函数,该函数将查询Kinesis Streams并将其返回.

My plan is to create a API gateway which calls an AWS Lambda function that would query Kinesis Streams and return it back.

是否可以使用Lambda查询Kinesis Streams,还是应该使用Kinesis Analytics和Lambda?

Is it possible to use Lambda to query Kinesis Streams or should we use Kinesis Analytics and Lambda?

您的方法不是使用Amazon Kinesis Streams的典型方法.

Your approach is not the typical way to use Amazon Kinesis Streams.

正常情况是将数据发送到Kinesis流,该流将数据保留24小时(但最多可以配置7天).然后,您的应用程序可以从流中提取数据并进行处理-实时更新内容或将信息存储在数据库中.实际上, Amazon Kinesis Firehose 可以自动将传入数据存储到Amazon S3,Amazon Redshift或Amazon Elasticsearch Service中.

The normal situation is that data is sent to a Kinesis stream, which holds the data for 24 hours (but can be configured for up to 7 days). Your app can then extract the data from the stream and processes it -- either updating something in real-time or storing information in a database. In fact, Amazon Kinesis Firehose can automatically store incoming data into Amazon S3, Amazon Redshift or Amazon Elasticsearch Service.

因此,流是经过处理而不是查询的.只需将它们视为可重播队列(而不是数据库)即可.

Thus, streams are processed rather than queried. Just think of them as replayable queues (rather than databases).

或者,您可以让Amazon Kinesis Streams 触发AWS每当有新消息到达流时,Lambda函数.这样可以对传入信息进行近实时处理.

Alternatively, you can have Amazon Kinesis Streams trigger an AWS Lambda function whenever a new message arrives in the stream. This allows near-realtime processing of incoming information.