Skip to the page

AWS interview question · hard

How would you design a data pipeline to ingest streaming data from Kinesis Data Streams, process it using Lambda, and store it in S3 in Parquet format?

The full answer

Designing a data pipeline to ingest streaming data from Kinesis Data Streams, process it using Lambda, and store it in S3 in Parquet format involves the following steps:

  1. Ingest Data with Amazon Kinesis Data Streams

    • Set up an Amazon Kinesis Data Stream to receive streaming data from sources like IoT devices, application logs, or event streams.
    • Configure data producers to push data into Kinesis.
  2. Process Streaming Data Using AWS Lambda

    • Create an AWS Lambda function that triggers automatically when new data arrives in Kinesis.
    • The Lambda function reads, transforms, and processes the incoming data.
    • Convert the processed data into a structured format suitable for Parquet conversion.
  3. Batch and Store Data in Amazon S3 in Parquet Format

    • Since Lambda has a memory and execution time limit, it should buffer data and write batches to Amazon S3.
    • To convert data to Parquet format, Lambda can use libraries like PyArrow or Pandas before writing to S3.
  4. Optimize Data Storage in S3

    • Store the data in partitioned folders (e.g., s3://my-bucket/year=2025/month=02/day=11/) to enable efficient querying with Athena.
    • Enable S3 lifecycle policies to manage data retention and cost optimization.
  5. Query and Analyze Data

    • Register the Parquet files in AWS Glue Data Catalog to make them queryable.
    • Use Amazon Athena or Amazon Redshift Spectrum to analyze the data directly from S3.

Trade-offs & Considerations:

  • ✅ Lambda is cost-effective and serverless, but it has execution time limits (max 15 minutes) and memory constraints (max 10GB).
  • ✅ Parquet format improves query performance and reduces storage costs compared to CSV or JSON.
  • ❌ For very high throughput data streams, consider using Amazon Kinesis Data Firehose instead of Lambda to batch and convert data to Parquet automatically.
  • ❌ If complex transformations are needed, an Amazon EMR Spark job may be better suited than Lambda for processing large-scale data efficiently.

Tecyfy Takeaway: This architecture provides a scalable and serverless solution for ingesting, processing, and storing streaming data in a cost-effective and query-optimized format. For high-volume streams, consider Kinesis Data Firehose or Spark on EMR instead of Lambda for better performance.

Last updated 11 February 2025