A company runs an e-commerce platform that generates clickstream data from user interactions on their website. The data is sent as JSON objects via HTTP POST to an API Gateway endpoint, which triggers a Lambda function that writes each record to a Kinesis Data Stream (100 shards). A second Lambda function consumes the stream, transforms the data (enriches with geolocation from a DynamoDB table), and writes to a Kinesis Data Firehose delivery stream that delivers Parquet files to an S3 data lake every 5 minutes. The system has been working for months, but recently the Firehose delivery stream started showing 'DeliveryFailed' errors for a subset of records. The errors point to 'InvalidData' from the Lambda transformation. The engineer reviews the Lambda transformation code and notices that the geolocation lookup occasionally fails because the DynamoDB table has a throttling issue. The engineer needs to handle these failures gracefully so that records that fail enrichment are still delivered to S3 with a null geolocation field, without blocking other records. Which course of action should the engineer take?
This ensures all records are delivered with a default value, maintaining pipeline throughput.
Why this answer
It modifies the Lambda function to catch exceptions during the geolocation lookup, set the geolocation field to null, and continue processing. This ensures that records that fail enrichment are still delivered to S3 with a null geolocation field, without blocking other records, and without requiring additional infrastructure. Option A is incorrect because Kinesis Data Firehose does not natively support a dead-letter queue (DLQ); failed records can be sent to an S3 bucket for failed data, but that would not include the transformed data with null geolocation.
Option B is incorrect because sending failed records to a separate Kinesis Data Stream adds complexity and does not ensure they are delivered to S3 with the desired null geolocation field. Option D is incorrect because increasing RCUs may reduce throttling but does not eliminate the possibility of failures, and it increases cost; the requirement is to handle failures gracefully, not prevent them entirely.