title: Serverless Framework how to create an AWS SQS DeadLetter queue?
body: <p>I am trying to create an AWS SQS Dead Letter Queue, using the serverless framework<br>
  The idea is to have a SQS to trigger a Lambda function,<br>
  and have another SQS as a DeadLetterQueue, ie. to pick up the message in case the Lambda fails or timesout<br></p>
  <p>I did the following to create a test project -</p>
  <pre><code>mkdir dlq
  cd dlq/
  serverless create --template aws-nodejs
  </code></pre>
  <p><strong>Following is my serverless.yaml -</strong></p>
  <pre><code>service: dlq
  
  provider:
    name: aws
    runtime: nodejs12.x
    region: ap-southeast-1
    role: arn:aws:iam::xxxx:role/dlqLambdaRole
  
  plugins:
    - serverless-plugin-lambda-dead-letter
  
  functions:
    dlq:
      handler: handler.hello
      events:
        - sqs:
            arn:
              Fn::GetAtt:
                - MainQueue
                - Arn
  
      deadLetter:
        targetArn:
          GetResourceArn: DeadLetterQueue
  
  resources:
      Resources:  
          MainQueue:
              Type: AWS::SQS::Queue
              Properties:
                  QueueName: main
          DeadLetterQueue:
              Type: AWS::SQS::Queue
              Properties:
                  QueueName: dlq
  </code></pre>
  <p><strong>I also tried the following -</strong></p>
  <pre><code>service: dlq
  
  provider:
    name: aws
    runtime: nodejs12.x
    region: ap-southeast-1
    role: arn:aws:iam::xxxx:role/dlqLambdaRole
  
  plugins:
    - serverless-plugin-lambda-dead-letter
  
  functions:
    dlq:
      handler: handler.hello
      events:
        - sqs:
            arn:
              Fn::GetAtt:
                - MainQueue
                - Arn
  
      deadLetter:
        sqs: dlq
  
  resources:
      Resources:
        MainQueue:
          Type: AWS::SQS::Queue
          Properties:
            QueueName: main
  </code></pre>
  <p>But in both these cases, the framework is just creating a normal SQS<br></p>
  <p>I am following this document -<br>
  <a href="https://www.serverless.com/plugins/serverless-plugin-lambda-dead-letter" rel="nofollow noreferrer">https://www.serverless.com/plugins/serverless-plugin-lambda-dead-letter</a></p>