Discuss how you would architect a system using AWS Lambda to process and analyze real-time streaming data from multiple sources. Include considerations for data integrity, scalability, and fault tolerance.
Instruction: Detail the architecture you would propose, including any AWS services you would integrate with Lambda. Explain how your design addresses the key considerations of data integrity, scalability, and fault tolerance.
Updated
Official answer
Define the event-time and processing-time requirements, throughput, ordering scope and tolerated lateness before selecting services. Use a durable stream such as Kinesis Data Streams or MSK to buffer producer traffic; a Lambda event source mapping reads records and invokes batches.
Give events stable identities and schema versions. Partition by the entity whose ordering matters, while checking hot-key risk. There is no global order across independent partitions or sources. Configure batch size/window, source-specific retry limits and failure capture, and monitor backlog age against source retention.
Make output application idempotent. For a purchase projection, record the processed event identity and update the projection atomically where the chosen database supports it. An atomic counter alone still increments twice when an event is retried. A transaction in one database does not atomically commit an unrelated S3 write or message publication; use an outbox or explicit reconciliation for that boundary.
Keep immutable raw data in S3 when needed for audit/reprocessing, then catalog it for Athena, Glue or warehouse workloads. State which dataset is authoritative and how duplicate, late, invalid and corrected records affect aggregates. Quarantine invalid events with a monitored replay process.
Scale from measured shard/partition throughput, mapping concurrency and sink capacity. Test poison records, duplicate batches, partial writes and outages longer than normal retry intervals. Use a stream-processing engine for workloads requiring stateful event-time joins/windows beyond the chosen Lambda design. Report end-to-end freshness, completeness and cost, not just successful invocation counts.
Related Questions
-
medium
-
medium
-
hard
-
hard