Skill 1.2.3: Transform streaming data (for example, by using AWS Lambda, Spark)
Question 1 - Stream Processing Architecture Selection
A financial services company is building a real-time fraud detection system that processes credit card transactions. The system must detect anomalies by comparing each transaction against a continuously updating rolling average of spending patterns over the last 15 minutes. Transactions arrive through Amazon Kinesis Data Streams at approximately 10,000 records per second, and the detection results must be written to Amazon DynamoDB within 2 seconds of transaction arrival. The company wants a solution that minimizes operational overhead while maintaining state across overlapping time windows.
Which AWS service should the ML engineer choose for this streaming transformation? (Select ONE)
- A) Configure an AWS Lambda function with a Kinesis trigger and a 15-minute non-overlapping aggregation window.
- B) Use AWS Glue streaming ETL with a Spark Structured Streaming job configured for sliding window aggregation.
- C) Deploy an Amazon Managed Service for Apache Flink application with a sliding window function over a 15-minute interval that slides every 30 seconds.
- D) Configure Amazon Kinesis Data Firehose to buffer transactions for 15 minutes before delivering them to DynamoDB.
Click to reveal Answer & Explanation
Correct Answer: C
Correct Options Analysis
- C is Correct: Amazon Managed Service for Apache Flink is purpose-built for stateful stream processing. The sliding window function maintains continuous state that updates as records arrive and expire from the window boundary. The 30-second slide interval provides overlapping window calculations that enable the continuously updated rolling average required for real-time anomaly detection.
Distractor Analysis
- A is Incorrect: AWS Lambda with Kinesis triggers supports fixed, non-overlapping windows (via tumbling window configuration) but cannot maintain state across continuously sliding overlapping windows. Lambda functions are event-driven and stateless by design; once a function invocation completes, its state is destroyed unless manually persisted externally.
- B is Incorrect: While AWS Glue streaming ETL with Spark Structured Streaming can perform sliding window aggregations, AWS Glue jobs require cluster startup and are designed for near-real-time (micro-batch) processing rather than strict 2-second latency requirements. The operational overhead of managing Glue job runs makes it a heavier choice than managed Flink for continuous streaming workloads.
- D is Incorrect: Kinesis Data Firehose is a delivery service that buffers data for batch loading into destinations; it does not perform stateful aggregations, sliding window calculations, or real-time transformations. Buffering cannot compute rolling averages within the required latency.
Key Takeaway: Use Amazon Managed Service for Apache Flink for continuously sliding windows and stateful stream processing; use Lambda for fixed non-overlapping windows; use Glue streaming for near-real-time micro-batch ETL.
Question 2 - Lambda vs. Spark for Stream State
An e-commerce company ingests clickstream events from Amazon Kinesis Data Streams into AWS for sessionization. The transformation needs to group events into user sessions, where a session is defined as a continuous series of events from the same user with no gap exceeding 2 minutes. The session definitions must be updated dynamically as new events arrive, and sessions can span up to 30 minutes. The ML team must choose between AWS Lambda and a Spark-based streaming solution.
Which TWO statements accurately guide the tool selection for this requirement? (Select TWO)
- A) AWS Lambda can process the Kinesis stream and maintain user session state within its execution environment across invocations if the function remains warm.
- B) Amazon EMR running Spark Structured Streaming with watermarking and stateful aggregations can maintain sessions that dynamically extend as new events arrive.
- C) AWS Lambda can process the stream with a fixed window configuration of 2 minutes to detect session boundaries, as long as the event source mapping is configured for windowed aggregation.
- D) A continuously updating session that extends based on event timing requires state that outlives any single function invocation, favoring a stateful streaming framework.
- E) AWS Lambda functions can maintain shared session state across invocations using environment variables, making them suitable for dynamic sessionization without external storage.
Click to reveal Answer & Explanation
Correct Answers: B and D
Correct Options Analysis
- B is Correct: Spark Structured Streaming running on Amazon EMR (or AWS Glue streaming) supports stateful aggregations with watermarking. This allows session state to be continuously updated as new events arrive, with watermarking handling late-arriving data and session expiration based on event timing.
- D is Correct: Dynamic sessionization requires state that persists and evolves across multiple events over time. AWS Lambda's execution model is stateless per invocation; any meaningful session state requires external persistence (e.g., DynamoDB), making stateful frameworks like Spark Structured Streaming or Apache Flink the natural fit.
Distractor Analysis
- A is Incorrect: AWS Lambda's execution environment does not reliably maintain in-memory state across invocations. Warm starts can preserve some state, but this is not guaranteed and scales unpredictably when multiple concurrent Lambda instances are processing the same stream. Relying on warm containers for critical state is an anti-pattern.
- C is Incorrect: AWS Lambda's windowed aggregation (tumbling windows) splits the stream into fixed, non-overlapping windows. Session detection requires variable-length, dynamically extending windows based on inter-event gaps, not fixed intervals. A 2-minute tumbling window cannot represent a session that spans 30 minutes.
- E is Incorrect: Environment variables are static configuration values set at deployment time, not a mechanism for maintaining dynamic runtime state across function invocations. They cannot be used to store and update user session data.
Key Takeaway: State that must dynamically extend beyond a single event (like sessions) requires a stateful stream processor (Flink/Spark); Lambda only supports stateless per-record processing or fixed non-overlapping windows.
Question 3 - Glue Streaming vs. Lambda for Real-Time Transformation
A logistics company processes IoT sensor data from delivery vehicles through Amazon Kinesis Data Streams. The transformation must parse JSON payloads, extract sensor readings, and perform a stateless geometric calculation on each record (converting GPS coordinates to a geohash). The results must be delivered to Amazon S3 in near-real-time. Operational simplicity is a priority, and the company wants to avoid managing any infrastructure.
Which solution meets these requirements with the LEAST operational overhead? (Select ONE)
- A) Deploy an Amazon EMR cluster running Spark Streaming to process the Kinesis stream and compute geohashes before writing to S3.
- B) Configure an AWS Lambda function with a Kinesis trigger to parse each record, compute the geohash, and write the result to S3 using a Lambda layer.
- C) Create an AWS Glue streaming ETL job that reads from Kinesis, applies the geohash transformation in a Spark Python UDF, and writes to S3.
- D) Use Amazon Kinesis Data Firehose with a Lambda transformer to compute the geohash on each record and deliver the transformed data to S3.
Click to reveal Answer & Explanation
Correct Answer: D
Correct Options Analysis
- D is Correct: Amazon Kinesis Data Firehose with a Lambda transformer is designed for stateless per-record transformations. Firehose handles the streaming infrastructure, buffering, and S3 delivery, while Lambda executes the geohash computation on each record. This provides a fully serverless architecture requiring zero infrastructure management, satisfying "least operational overhead."
Distractor Analysis
- A is Incorrect: Amazon EMR with Spark Streaming requires provisioning and managing a cluster, configuring Spark applications, and monitoring cluster health. This introduces significant operational overhead compared to serverless alternatives for a simple stateless transformation. EMR is better for complex multi-stage transformations or when using existing Spark codebases.
- B is Incorrect: While AWS Lambda with Kinesis is serverless, writing directly to S3 per record can lead to many small files. Firehose handles batching and buffering for efficient S3 delivery, reducing operational burden. Additionally, managing Lambda's Kinesis event source mappings and checkpointing adds complexity that Firehose avoids.
- C is Incorrect: AWS Glue streaming ETL requires creating and managing Glue job configurations, handling Spark session management, and managing job runs. Although serverless, Glue introduces more complexity and maintenance than Firehose for a stateless per-record transform. Glue adds value when transformations are stateful or require complex SQL operations.
Key Takeaway: For stateless per-record transformations over streaming data, Kinesis Data Firehose + Lambda is the lowest-overhead pattern; Glue streaming and EMR are heavier options used for stateful or complex transformations.
Question 4 - Sliding Window Calculation Requirement
A media streaming platform processes viewer engagement metrics from Amazon Kinesis Data Streams. The engineering team needs to compute a 10-minute moving average of viewer engagement scores per content asset. The average must update continuously as engagement events arrive and automatically exclude events older than 10 minutes. The solution must provide exactly-once processing semantics to prevent incorrect aggregation in case of retries.
Which architecture pattern satisfies these requirements? (Select ONE)
- A) Configure AWS Lambda with a Kinesis trigger and a batch window of 10 minutes, relying on Lambda's built-in idempotency for exactly-once processing.
- B) Use AWS Glue streaming ETL with Spark Structured Streaming, setting a sliding window of 10 minutes with a slide duration of 1 minute and configuring output mode to
complete. - C) Deploy an Amazon Managed Service for Apache Flink application using a sliding time window of 10 minutes with state checkpoints, enabling exactly-once semantics from the Kinesis source.
- D) Configure Amazon EventBridge Pipes to connect Kinesis to DynamoDB, with a pipe destination that computes moving averages during data transfer.
Click to reveal Answer & Explanation
Correct Answer: C
Correct Options Analysis
- C is Correct: Amazon Managed Service for Apache Flink (formerly Kinesis Data Analytics) provides built-in state management, checkpointing, and exactly-once guarantees when reading from Kinesis Data Streams. Its sliding window function continuously updates as new events arrive and automatically expires events outside the window boundary, providing the moving average behavior with precise control over slide intervals. Checkpointing ensures state is durable and recoverable without double-counting.
Distractor Analysis
- A is Incorrect: AWS Lambda does not provide exactly-once processing guarantees for Kinesis by default; it supports at-least-once delivery, requiring developers to implement their own deduplication. Additionally, Lambda's batch window is not a sliding window; it groups records for a single invocation but does not maintain state across invocations for moving averages.
- B is Incorrect: While Spark Structured Streaming can perform sliding window aggregations, the
completeoutput mode outputs the entire result table on every trigger, which is inefficient for continuous streaming aggregation. Additionally, AWS Glue streaming jobs in a serverless context have limitations around continuous execution and latency for true streaming workloads. Spark Structured Streaming relies on micro-batching rather than continuous processing. - D is Incorrect: Amazon EventBridge Pipes is designed for point-to-point data transfer and transformation between sources and destinations; it does not provide stateful stream processing, sliding window calculations, or moving average computations. EventBridge Pipes works with Lambda transforms but cannot maintain the aggregation state required for moving averages across records.
Key Takeaway: Exactly-once semantic requirements in streaming force selection toward Flink (or Spark with watermarking); Lambda and EventBridge Pipes are designed for stateless or at-least-once processing models.
Question 5 - Debugging Lambda Windowed Aggregation
A retail analytics team configured an AWS Lambda function with a Kinesis Data Streams event source mapping using a tumbling window of 60 seconds. The Lambda function is supposed to aggregate the total count of purchase events per window and write the aggregated value to Amazon CloudWatch metrics every minute. However, the team observes that some records are being missed, and the count does not match the total records ingested.
Which TWO factors could contribute to this discrepancy? (Select TWO)
- A) The Lambda function is writing metrics to CloudWatch asynchronously, causing delays in metric visibility.
- B) Lambda tumbling windows process records in batches with a maximum payload size, and records exceeding the batch size are dropped silently.
- C) The Lambda function's execution timeout is set lower than the time needed to process all events in a window, causing truncation.
- D) Lambda tumbling windows provide at-least-once delivery semantics, so duplicate processing can occur but records are not dropped.
- E) The Kinesis data stream has more than one shard, and the Lambda function processes each shard independently, but the aggregation logic assumes a single stream-wide window.
Click to reveal Answer & Explanation
Correct Answers: C and E
Correct Options Analysis
- C is Correct: If the Lambda function's timeout is set too low (default 3 seconds, max 15 minutes), processing of a tumbling window may be truncated before all records in that window are processed, leading to missed aggregations and lower counts. The function must have a timeout that accommodates processing all records in the window.
- E is Correct: Lambda processes each shard of a Kinesis stream independently. Tumbling windows are scoped per shard, not stream-wide. If the aggregation logic assumes all records from a single 60-second window across all shards arrive in one Lambda invocation, records from some shards will be missed from the count because each shard's window is processed separately.
Distractor Analysis
- A is Incorrect: CloudWatch metrics have asynchronous delivery (approximately 1-minute latency), but this affects visibility timing, not the actual count of processed records. Missing records indicate a processing issue rather than a metric delivery delay.
- B is Incorrect: Lambda handles Kinesis batch payloads with a maximum size, but excess records are not silently dropped. Kinesis Data Streams maintains a backlog, and Lambda will continue polling until records are processed. The system is designed to handle backpressure rather than drop data.
- D is Incorrect: While Lambda with Kinesis does provide at-least-once delivery (not exactly-once), this causes duplicate processing, not missing records. Duplicate counts would result in higher numbers than expected, not lower. The discrepancy described (count not matching total ingested, implying undercount) points to timeout or shard-scoping issues.
Key Takeaway: Lambda tumbling windows are scoped per shard; for stream-wide aggregations, use a Flink application or aggregate per-shard results downstream. Always set Lambda timeouts above the expected processing time for all records in a window.
Question 6 - Spark Streaming Session Window Configuration
A healthcare analytics company processes patient vital sign streams from wearable devices through Amazon Kinesis Data Streams into Amazon EMR running Spark Structured Streaming. The ML engineer needs to define user sessions where a session ends when no data arrives from a device for 5 minutes. However, monitoring shows that sessions are being prematurely terminated after exactly 5 minutes of processing time, not after 5 minutes of event time.
Which configuration change should the engineer make to fix this issue? (Select ONE)
- A) Set the Spark streaming trigger interval to 5 minutes to align processing time with event time.
- B) Configure watermarking on the event timestamp column with a delay threshold of 5 minutes before session expiration.
- C) Increase the Spark executor memory to handle longer sessions without premature termination.
- D) Change the Kinesis retention period to 5 minutes so records match the session timeout window.
Click to reveal Answer & Explanation
Correct Answer: B
Correct Options Analysis
- B is Correct: Spark Structured Streaming's
withWatermark()method on the event timestamp column is the correct mechanism for session window expiration based on event time, not processing time. Watermarking tells Spark how late to wait for out-of-order events before finalizing a session window. The watermark delay should account for the 5-minute idle threshold plus maximum expected event delay.
Distractor Analysis
- A is Incorrect: The trigger interval controls how frequently Spark checks for new data (micro-batch frequency), not the session window expiration logic. Adjusting the trigger interval does not affect how sessions are defined or when they end based on event time. Sessions remain prematurely terminated if watermarking is not configured.
- C is Incorrect: Executor memory affects the amount of data each Spark executor can hold, not the timing semantics of session windows. Increasing executor memory allows larger state stores or more in-memory aggregations but does not change the event-time logic used to determine session boundaries.
- D is Incorrect: The Kinesis retention period determines how long records are available in the stream for consumers to read. It does not influence Spark's session window logic or event-time processing. Changing retention affects data availability, not aggregate window timing.
Key Takeaway: In Spark Structured Streaming, always use watermarking with event timestamps to define session windows based on event time; without it, session expiration follows processing time, causing incorrect session boundaries.
Question 7 - Stream and Batch Consistency
An ML engineering team maintains a real-time fraud detection model that processes events through Amazon Kinesis Data Streams using an Amazon Managed Service for Apache Flink application. The same feature engineering logic (log transformation, scaling, one-hot encoding) is applied in batch mode using AWS Glue for periodic model retraining. The team notices that the streaming model performs worse than the batch model despite identical input data.
Which action resolves the feature consistency issue? (Select ONE)
- A) Increase the Flink application's parallelism to match the Glue job's Spark partition count.
- B) Store the fitted transformer parameters from the Glue training pipeline in Amazon SageMaker Feature Store and reference them from the Flink application.
- C) Use the same Apache Spark library in the Flink application to guarantee identical transformations.
- D) Adjust the Kinesis stream's shard count to match the Glue job's data partitioning scheme.
Click to reveal Answer & Explanation
Correct Answer: B
Correct Options Analysis
- B is Correct: Feature engineering transformers (scalers, encoders, normalizers) must be fitted once, typically on training data, and then applied identically to all subsequent data in both batch and streaming pipelines. Storing the fitted transformer parameters in Amazon SageMaker Feature Store centralizes the transformation contract, ensuring both pipelines read the same scaling statistics and encoding mappings. Without this, the Flink application may refit scalers on live streaming data, producing different feature values than the batch pipeline used for training.
Distractor Analysis
- A is Incorrect: Parallelism is a performance optimization that controls how many concurrent processing tasks run, not feature definition. Increasing parallelism does not address differences in scaling, encoding, or other transformation logic between pipelines.
- C is Incorrect: Using the same library does not guarantee consistent transformations because scalers and encoders compute parameters from data. If the streaming and batch pipelines fit their own transformer instances independently, they will produce different transformation parameters, even with the same library. Both must reference the same fitted instance.
- D is Incorrect: Kinesis shard count affects stream throughput and parallel processing capacity, not feature definitions. Adjusting shard count does not align the scaling or encoding logic between streaming and batch pipelines.
Key Takeaway: Feature engineering transforms must be fitted once (typically on training data) and consistently applied across batch and streaming pipelines; store fitted parameters in SageMaker Feature Store to eliminate training-serving skew.
Question 8 - Combined Lambda and Flink Architecture
An advertising technology company processes real-time bidding data at very high throughput (50,000 events per second). The transformation pipeline has two stages: (1) parse and enrich each bid event with user profile data from Amazon DynamoDB, and (2) compute a 30-second rolling average of bid values across all events to detect anomalies. The company wants to minimize costs while ensuring the rolling average is continuously updated with sub-second latency.
Which architecture best serves these requirements? (Select ONE)
- A) Use AWS Lambda for both stages: trigger on each event for parsing and enrichment, and use a second Lambda function with a tumbling window for the rolling average.
- B) Use Amazon Managed Service for Apache Flink for both stages: the first operator performs record enrichment with async DynamoDB lookups, and the second applies a sliding window function for the rolling average.
- C) Use AWS Lambda for record enrichment and Amazon Managed Service for Apache Flink for the sliding window rolling average, connecting them through a second Kinesis stream.
- D) Use AWS Glue streaming ETL for both stages: a Spark structured streaming job that performs enrichment and sliding window averaging in a single pipeline.
Click to reveal Answer & Explanation
Correct Answer: B
Correct Options Analysis
- B is Correct: Amazon Managed Service for Apache Flink provides continuous stream processing with low-latency State Management. The first Flink operator handles stateless enrichment with asynchronous DynamoDB lookups (using Flink's async I/O capability), and the second operator applies a sliding window for the 30-second rolling average. Combining both in a single Flink application avoids the overhead of managing multiple pipelines, secondary stream hops, or Lambda timeouts, while maintaining sub-second latency and minimizing cost at this throughput.
Distractor Analysis
- A is Incorrect: At 50,000 events per second, Lambda costs scale significantly alongside concurrency. Additionally, Lambda's tumbling window produces overlapping state only in fixed non-overlapping segments, not the continuously sliding window required for a sub-second rolling average. The architecture fails to meet the "continuously updated" requirement.
- C is Incorrect: While mixing Lambda for enrichment and Flink for aggregation is architecturally valid, it introduces additional operational complexity and cost at this throughput. The extra Kinesis stream hop adds latency and management burden. Lambda would need to handle 50,000 events per second, which becomes expensive compared to doing this inside Flink. Flink alone handles both stages more efficiently.
- D is Incorrect: AWS Glue streaming ETL with Spark Structured Streaming works well for micro-batch near-real-time processing but fails to meet the sub-second latency requirement for a continuously updating rolling average. Glue also incurs cluster startup costs and is not optimized for long-running continuous streaming jobs compared to managed Flink.
Key Takeaway: When requirements combine stateless enrichment and stateful sliding window aggregation at high throughput, a single Flink application often provides the lowest latency, cost, and operational overhead compared to mixing Lambda and Glue streaming components.
Question 9 - Debugging Glue Streaming Window Emissions
A data engineer runs an AWS Glue streaming ETL job on Apache Spark Structured Streaming that reads from Amazon Kinesis Data Streams and computes a 5-minute sliding window average. The window is defined with a slide duration of 1 minute. The engineer expects results every minute but observes that outputs are emitted every 5 minutes instead. The output mode is set to append.
Which TWO adjustments would cause results to emit every minute? (Select TWO)
- A) Change the output mode from
appendtoupdate. - B) Reduce the watermark delay threshold to less than 1 minute.
- C) Increase the slide duration to 5 minutes to match the window size.
- D) Set the trigger interval to 1 minute to process new micro-batches.
- E) Set the symptom window slide duration to 1 minute, which is already configured correctly; verify the trigger interval matches the expectation.
Click to reveal Answer & Explanation
Correct Answers: A and D
Correct Options Analysis
- A is Correct: In Spark Structured Streaming,
appendoutput mode only emits a result when a window is finalized, which occurs after the watermark passes the window's end time. For a 5-minute sliding window, the initial window finalizes after approximately 5 minutes from the first event. Changing toupdateoutput mode emits results as new data arrives, even before the window is finalized, allowing for 1-minute updates. - D is Correct: Spark Structured Streaming processes data in micro-batches defined by the trigger interval. If the trigger interval is set to 5 minutes (or some value larger than the slide duration), Spark only processes data every 5 minutes, regardless of the sliding window's 1-minute slide. Setting the trigger to 1 minute ensures new micro-batches are processed every minute, allowing for the expected 1-minute slide emissions.
Distractor Analysis
- B is Incorrect: While watermark delay affects when window results are finalized, reducing it below 1 minute would risk dropping late-arriving data and could cause incorrect aggregations. The watermark should account for the maximum expected event delay; simply reducing it to force earlier emissions sacrifices accuracy for timing.
- C is Incorrect: Increasing slide duration to 5 minutes means windows only overlap every 5 minutes (non-overlapping or tumbling every 5 minutes), which would produce results every 5 minutes or longer, opposite to the desired 1-minute emission rate. The problem is not the slide duration but the output mode and trigger configuration.
- E is Incorrect: This option contains incomplete configuration verification. While verifying the trigger interval is important, the slide duration is already correctly set to 1 minute. The issue is the output mode and trigger interval, not the slide duration. Simply verifying without making changes does not fix the problem.
Key Takeaway: In Spark Structured Streaming, both output mode and trigger interval control result emission timing:
updateemits intermediate results, and the trigger controls micro-batch frequency;appendonly emits finalized window results.
Question 10 - Flink vs. Lambda Handler Design for Session State
A software engineering team is developing a real-time chat application that tags incoming messages with an emotional tone classifier. The system receives messages from Amazon SQS (Standard Queue) and must perform context-aware classification where the emotion of the current message depends on the previous 5 messages from the same user. The team considers using either AWS Lambda (with DDB state) or a custom Flink application on Amazon EMR.
Which TWO statements accurately describe the architectural trade-offs? (Select TWO)
- A) AWS Lambda can maintain per-user message history using DynamoDB conditional writes, but this adds latency and complexity compared to Flink's in-memory state management.
- B) Amazon SQS Standard queues guarantee exactly-once delivery, allowing Lambda to maintain accurate message count for context tracking.
- C) A Flink application on Amazon EMR can scale horizontally with parallelism configured by the number of partitions in the SQS source.
- D) AWS Lambda processes SQS messages in strict FIFO order, ensuring that user message context is always correct.
- E) A custom Flink application on Amazon EMR requires cluster management overhead, but provides lower-latency state access for context-aware classification.
Click to reveal Answer & Explanation
Correct Answers: A and E
Correct Options Analysis
- A is Correct: AWS Lambda is stateless per invocation. To maintain recent message context for each user, Lambda must persist state externally, such as in DynamoDB with conditional writes and reads on every invocation. This adds latency (DynamoDB read/write per message) and complexity (handling concurrent writes, expiring old messages). Flink's state store (RocksDB/in-memory) provides faster state access with built-in management.
- E is Correct: Amazon EMR requires provisioning, configuring, and managing a cluster, which adds operational overhead compared to serverless Lambda. However, Flink's state is maintained in memory or embedded state stores (RocksDB), which provides lower-latency access compared to external lookups to DynamoDB for every message. This makes Flink well-suited for stateful context-aware processing.
Distractor Analysis
- B is Incorrect: Amazon SQS Standard queues provide at-least-once delivery, meaning duplicate messages can occur under retry scenarios. Only SQS FIFO queues provide exactly-once processing, but FIFO queues have lower throughput limits and message ordering constraints. A Lambda-based solution must implement deduplication logic.
- C is Incorrect: Amazon SQS is a pull-based queue, not a streaming source with partitions. Flink's SQS source connector does not use partition-based parallelism like Kinesis or Kafka. Scaling a Flink application connected to SQS is more complex and typically involves worker poll concurrency rather than source partition count.
- D is Incorrect: AWS Lambda processes SQS messages in batches, and the order of invocation across multiple Lambda instances is not guaranteed to be FIFO. Even if a single Lambda instance processes messages sequentially, concurrent Lambda instances processing different batches from the same queue can lead to messages being processed out of order with no global ordering guarantee.
Key Takeaway: For stateful context-dependent processing, Flink applications provide faster state access but require cluster management; Lambda with external state stores (DynamoDB) is simpler to deploy but adds per-message latency and complexity. Choose based on latency requirements and operational tolerance.