# Dead letter queue config?

**URL:** <https://forum.serverless.com/t/dead-letter-queue-config/1358>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [February 20, 2017, 3:54pm UTC](https://forum.serverless.com/t/dead-letter-queue-config/1358 "2017-02-20T15:54:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![walshe](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/walshe/32/1032_2.png) [@walshe](https://forum.serverless.com/u/walshe)\
**Post date:** [February 20, 2017, 3:54pm UTC](https://forum.serverless.com/t/dead-letter-queue-config/1358/1 "2017-02-20T15:54:18Z")

</div>

Hi,

could someone help with with an example of how to provide a dead letter queue for my existing SQS queue:

e.g. below

service: email-integration

provider:  
name: aws  
runtime: nodejs4.3

stage: dev  
region: eu-west-1

iamRoleStatements:  
- Effect: "Allow"  
Action:  
- "sqs:_"  
Resource: "arn:aws:sqs:_:_:emailtaskqueue"  
- Effect: "Allow"  
Action:  
- "lambda:_"  
Resource: “\*”

functions:  
hello:  
handler: handler.hello  
events: # All events associated with this function  
- http:  
path: hello  
method: get

emailRequestListener:  
handler: emailRequestListener/handler.emailRequestListener  
events:  
- http:  
path: sendEmail  
method: post

emailTaskConsumer:  
handler: emailTaskConsumer/handler.emailTaskConsumer  
timeout: 200  
events:  
- schedule: rate(1 minute)

emailWorker:  
handler: emailWorker/handler.emailWorker

resources:  
Resources:  
EmailTaskDeadLetterQueue:  
Type: 'AWS::SQS::Queue’  
Properties:  
MessageRetentionPeriod: 1209600  
QueueName: emailtaskdeadletterqueue

```
EmailTaskQueue:
  Type: 'AWS::SQS::Queue'
  Properties:
    MessageRetentionPeriod: 1209600
    QueueName: emailtaskqueue
    RedrivePolicy:
        ???
```

---

<div class="post-metadata">

**Author:** ![hamletrp](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/hamletrp/32/3142_2.png) [@hamletrp](https://forum.serverless.com/u/hamletrp)\
**Post date:** [December 9, 2019, 4:59pm UTC](https://forum.serverless.com/t/dead-letter-queue-config/1358/2 "2019-12-09T16:59:42Z")

</div>

Hey @walshe,  
I know it might be a bit late, but I see the question is unanswered and I feel compelled to collaborate.

Please serve yourself how to setup the DLQ to a lambda function straight in your yml file, the next picture will show you an example, I’ll also paste some text down below, is as simple as that.

\<your\_function\_name\>:  
handler: \<your\_handler\>  
timeout: 12  
memorySize: 576  
reservedConcurrency: 20 # optional, Overwrite the default reserved concurrency limit. By default, AWS uses account concurrency limit  
**onError: arn:aws:sns:eu-west-2:############:FailedFns # Optional SNS topic / SQS arn (Ref, Fn::GetAtt and Fn::ImportValue are supported as well) which will be used for the DeadLetterConfig**

As you can see the bolded text, the [**onError**] config attr is the way to config the DLQ for a function. You are also allowed to use CloudFormation sintax here.

I hope this helps.

Cheers!  
Hamlet

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/serverless/original/2X/8/84cb40216afd450dbd4415333f8b68653f6f82d2.png)
