Retention not configured for failed asynchronous Lambda events

Provide a path to investigate and retry failed asynchronous events.

Description

For asynchronous Lambda invocations, retain events that exhaust their retries or exceed the maximum event age with a dead-letter queue (DLQ) or failure destination.

Potential impact

Without the failed input, investigation and reprocessing become difficult.

Remediation

For a DLQ, set DeadLetterConfig.TargetArn to a standard SQS queue or SNS topic and grant the execution role permission to send to it. Check retention and replay. If SQS is the event source, configure its DLQ on the source queue instead.

Examples

The second excerpt selects an SQS queue and changes the function’s logical ID from Function to Function3. Keep the existing ID when updating only the DLQ. Supply a supported LambdaRuntime compatible with the ZIP, the queue and the role.

Before

yaml
AWSTemplateFormatVersion: '2010-09-09'
Description: VPC function.
Resources:
  Function:
    Type: AWS::Lambda::Function
    Properties:
      Handler: index.handler
      Role: arn:aws:iam::123456789012:role/lambda-role
      Code:
        S3Bucket: my-bucket
        S3Key: function.zip
      Runtime: !Ref LambdaRuntime
      Timeout: 5
      TracingConfig:
        Mode: Active
      VpcConfig:
        SecurityGroupIds:
          - sg-085912345678492fb
        SubnetIds:
          - subnet-071f712345678e7c8
          - subnet-07fd123456788a036
      Tags:
        - Key: Description
          Value: VPC Function
        - Key: Type
          Value: AWS Lambda Function

After

yaml
AWSTemplateFormatVersion: '2010-09-09'
Description: VPC function.
Resources:
  Function3:
    Type: AWS::Lambda::Function
    Properties:
      Handler: index.handler
      Role: arn:aws:iam::123456789012:role/lambda-role
      Code:
        S3Bucket: my-bucket
        S3Key: function.zip
      Runtime: !Ref LambdaRuntime
      Timeout: 5
      TracingConfig:
        Mode: Active
      VpcConfig:
        SecurityGroupIds:
          - sg-085912345678492fb
        SubnetIds:
          - subnet-071f712345678e7c8
          - subnet-07fd123456788a036
      Tags:
        - Key: Description
          Value: VPC Function
        - Key: Type
          Value: AWS Lambda Function
      DeadLetterConfig:
        TargetArn: arn:aws:sqs:us-east-1:123456789012:aaa

References