Menu
AWS Lambda
Developer Guide

Dead Letter Queues

By default, a failed Lambda function invoked asynchronously is retried twice, and then the event is discarded. Using Dead Letter Queues (DLQ), you can indicate to Lambda that unprocessed events should be sent to an Amazon SQS queue or Amazon SNS topic instead, where you can take further action.

You configure a DLQ by specifying a target Amazon Resource Name (ARN) on a Lambda function's DeadLetterConfig parameter of an Amazon SNS topic or an Amazon SQS queue where you want the event payload delivered, as shown in the following code. For more information about creating an Amazon SNS topic, see Create an SNS Topic. For more information about creating an Amazon SQS queue, see Tutorial: Creating an Amazon SQS Queue.

{
    "Code": {
        "ZipFile": blob,
        "S3Bucket": “string”,
        "S3Key": “string”,
        "S3ObjectVersion": “string”
    },
    "Description": "string",
    "FunctionName": "string",
    "Handler": "string",
    "MemorySize": number,
    "Role": "string",
    "Runtime": "string",
    "Timeout": number
    "Publish": bool,
    "DeadLetterConfig": {
        "TargetArn": "string" 
    }
} 

Lambda directs events that cannot be processed to the Amazon SNS topic or Amazon SQS queue that you’ve configured for the Lambda function. Functions without an associated DLQ discard events after they have exhausted their retries. For more information about retry policies, see Retries on Errors. You need to explicitly provide read/publish/sendMessage access to your DLQ resource as part of the execution role for your Lambda function. The payload written to the DLQ target ARN is the original event payload with no modifications to the message body. The attributes of the message, described below, contain information to help you understand why the event wasn’t processed:

NameTypeValue
RequestID StringUnique request identifier
ErrorCodeNumber3-digit HTTP error code
ErrorMessageStringError message (truncated to 1 KB)

If for some reason, the event payload consistently fails to reach the target ARN, Lambda increments a CloudWatch metric called DeadLetterErrors and then deletes the event payload.