Skip to main content
This lesson walks through an end-to-end demo that streams synthetic price updates (e.g., crypto or stock prices) into Amazon Kinesis Data Streams, routes those records through Kinesis Data Firehose, and persists them into Amazon S3. We’ll:
  • Create a Kinesis Data Stream.
  • Create a Kinesis Data Firehose delivery stream that uses the Kinesis stream as its source.
  • Configure S3 as the Firehose destination (create a bucket if needed).
  • Produce test records into the Kinesis stream using the AWS SDK for JavaScript (v3).
Why this matters: this pattern is common for real-time ingestion pipelines where you want low-latency capture (Kinesis Data Streams) and durable, batched delivery (Firehose -> S3) for downstream analytics.

Architecture overview

1) Create the Kinesis Data Stream

When creating a data stream you must choose a capacity mode:
  • Provisioned — choose explicit shard count when you want fine-grained throughput control and cost predictability.
  • On-demand — automatic scaling with no shard management; simpler but can be more expensive for high sustained throughput.
If you expect variable traffic and want minimal operational overhead, start with on-demand. If you need predictable cost and throughput guarantees for steady heavy workloads, choose provisioned and set shards accordingly.
Screenshot of the AWS Kinesis console "Create data stream" page showing write/read capacity limits and an on-demand pricing note. A Data stream settings table is visible with a highlighted "Create data stream" button at the bottom.
Example stream name used in this demo: crypto-stock-price.

2) Create the Firehose delivery stream and choose S3 as destination

  • In the Firehose creation workflow, choose Kinesis Data Stream as the source and select the stream you created.
  • Choose S3 as the destination. Either pick an existing bucket or create a new one during the delivery stream setup.
  • Optionally enable buffering, compression, or format conversion (JSON → Parquet/ORC). For this demo we forward raw JSON into S3.
A screenshot of the AWS console showing a "Choose Kinesis data stream" dialog with one stream listed named "crypto-stock-price" marked Active. There's a search box and a highlighted "Choose" button in the bottom-right.
Notes:
  • Buffering settings (size and interval) control how frequently Firehose writes objects to S3. Smaller intervals yield more objects; larger intervals reduce PUT count but increase object size.
  • Leaving transformation/format conversion disabled will deliver raw payloads as-is.

3) Confirm S3 delivery and inspect the results

After Firehose becomes active and starts consuming from the Kinesis stream, it will buffer records and periodically write objects to the configured S3 bucket using the prefix and partition scheme you configured. Objects are usually organized by year/month/day/hour in the S3 console.
A screenshot of the Amazon S3 web console showing the bucket path (ending in "00/") with one listed object (a KDS-S3 file, 68.0 KB). The UI shows controls like Upload, Create folder, and object actions.
When you open a delivered object, it typically contains multiple JSON records concatenated together (newline-delimited or concatenated JSON depending on Firehose settings). Example excerpt from a delivered object:
This confirms the end-to-end flow: Producer (Node.js) -> Kinesis Data Stream -> Firehose (source) -> S3 (destination)

4) Produce test records using AWS SDK for JavaScript (v3)

Prerequisites:
  • Node.js (v14+ recommended)
  • AWS credentials configured (environment variables, shared credentials file, or AWS CLI setup)
  • Install the Kinesis client:
    • npm install @aws-sdk/client-kinesis
Important: If you use ES module imports as shown below, run Node.js in ES module mode (for example set "type": "module" in package.json) or convert imports to CommonJS require calls. Example producer script:
Run it:
Let it run for a couple of minutes to allow Firehose to buffer and write several objects to S3.
Running a high-frequency producer continuously can generate costs (Kinesis Data Streams, Firehose, S3 PUTs, and storage). Stop the producer when you’re done testing.

Optional: Data transformation and format conversion

If you want to transform or enrich records before they reach S3:
  • Enable Firehose data transformation and provide a Lambda function to process each batch.
  • Enable format conversion to convert newline-delimited JSON to Parquet/ORC — this improves query performance and reduces storage for analytic workloads.

Troubleshooting checklist

  • Are AWS credentials and region configured? Use aws sts get-caller-identity to verify.
  • Is the Firehose delivery stream in an Active state?
  • Are IAM permissions correct for Firehose to write to your S3 bucket and for Kinesis to be used as a source?
  • Check CloudWatch logs for Firehose or the transformation Lambda (if enabled).
That wraps up this demo: you now have a working pipeline streaming test data into Kinesis and persisting it to S3 via Firehose.

Watch Video