설명
Lambda의 비동기 호출에서 재시도나 이벤트 보관 한도를 소진한 이벤트는 별도 대상으로 보낼 수 있습니다. DLQ나 실패 대상이 없으면 이러한 이벤트를 보관하지 못할 수 있습니다.
잠재적 영향
실패한 입력을 확보하지 못하면 원인 분석과 재처리가 어려워질 수 있습니다.
해결 방법
DeadLetterConfig.TargetArn에 표준 SQS 큐 또는 SNS 토픽을 지정하거나 비동기 실패 대상을 구성하세요. 전송 권한과 보관·재처리 절차를 확인하세요. SQS 이벤트 소스는 원본 큐의 DLQ를 구성해야 합니다.
예시
예시는 비동기 호출용 DLQ를 추가합니다. LambdaRuntime에는 함수 ZIP과 호환되는 지원 런타임을 지정하고, 대상 큐와 실행 역할 권한은 별도로 준비하세요.
변경 전
yaml
AWSTemplateFormatVersion: '2010-09-09'
Description: VPC 함수.
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
변경 후
yaml
AWSTemplateFormatVersion: '2010-09-09'
Description: VPC 함수.
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