This guide demonstrates using Amazon Kinesis to stream dummy data mimicking crypto or stock trading prices into an S3 bucket.
This guide demonstrates how to work with Amazon Kinesis for streaming dummy data that mimics crypto or stock trading prices. The process involves transmitting data from a Kinesis Data Stream to a Kinesis Firehose Delivery Stream, which then deposits the data in an S3 bucket. In this tutorial, you will learn how to configure each component and run a test using the AWS SDK for JavaScript.
Set up a Kinesis Data Firehose delivery stream to channel data into an S3 bucket. Follow these steps:
Source Selection: Choose the Kinesis Data Stream you just created as the data source.
Destination: Set the destination to an S3 bucket.
If needed, enable data transformation by configuring a Lambda function. This feature is useful when you need to modify record formats. For demonstration purposes, we will use the default settings.
Before completing the Firehose configuration, confirm that an S3 bucket is available. If you do not have one, create a new bucket (using “Kinesis Code Cloud demo” as an example). Refresh or browse for your bucket, then finalize the setup by keeping the remaining settings at default and clicking Create Delivery Stream.
Once your data stream and Firehose are configured, test the setup by sending sample data to the Kinesis Data Stream using the AWS SDK for JavaScript.The following code snippet demonstrates how to construct a record and send it to the data stream:
Once the data is processed by the Firehose delivery stream, navigate to your S3 bucket to verify the records. You should observe a directory matching the current date (e.g., “2023”) that contains several files with the streamed data.
If you open one of these files, the output will appear similar to this:
While this guide covers the fundamental process of transmitting data from a Kinesis Data Stream to an S3 bucket using Kinesis Firehose, additional features are available. For example, you can utilize Lambda functions for on-the-fly data transformation, which is beneficial if you need to modify the record formats or convert data types.That concludes this comprehensive demo of setting up and using Amazon Kinesis. We hope this guide helps you effectively integrate and manage streaming data for your applications.For further information, consult the following resources: