This rule ensures Lambda functions have a dead-letter queue for better error handling.
Rule | Lambda functions should be configured with a dead-letter queue |
Framework | NIST 800-171 Revision 2 |
Severity | ✔ Medium |
Rule Description
Lambda functions should be configured with a dead-letter queue to comply with the security requirement NIST 800-171 Revision 2. This rule ensures that any failed Lambda function invocations have a designated queue for error handling and logging purposes.
Troubleshooting Steps
If your Lambda function does not have a dead-letter queue configured, follow these steps to troubleshoot the issue:
Check Lambda Configuration: Verify that the dead-letter queue configuration is indeed missing in the Lambda function.
Review CloudWatch Logs: Check the CloudWatch Logs for the Lambda function to see if any error messages or exceptions are being logged.
Investigate Function Role Permissions: Ensure that the IAM role associated with the Lambda function has the necessary permissions to write to the dead-letter queue. Check for any permission-related errors in the function's execution log.
Examine Queue Permissions: Validate the permissions of the dead-letter queue to confirm that Lambda has the necessary write permissions to the queue.
Test Function Invocation: Invoke the Lambda function and monitor the response. If the function fails, ensure that the error is not due to a missing dead-letter queue.
Code Configuration
To configure a dead-letter queue for a Lambda function, you can use the AWS CLI or AWS Management Console. Below are the necessary steps for both options:
Using AWS Management Console:
Open the AWS Management Console and navigate to the AWS Lambda service.
Select the Lambda function for which you want to configure the dead-letter queue.
Under the Configuration tab, scroll down to the Dead Letter Queue section and click "Edit".
Choose an existing SQS (Simple Queue Service) queue or create a new one.
Click "Save" to apply the changes.
Using AWS CLI:
Open your preferred command-line interface.
Use the
aws lambda update-function-configuration
command, specifying the function name and the --dead-letter-config
parameter with the ARN (Amazon Resource Name) of the desired dead-letter queue.aws lambda update-function-configuration \ --function-name <function-name> \ --dead-letter-config TargetArn=<dead-letter-queue-arn>
Remediation Steps
To remediate the issue of not having a dead-letter queue configured for a Lambda function, follow these steps:
Identify the Lambda functions for which a dead-letter queue needs to be configured.
Choose the appropriate method (AWS Management Console or AWS CLI) to configure the dead-letter queue as mentioned in the previous section.
If using the AWS Management Console:
If using the AWS CLI:
aws lambda update-function-configuration
command as specified in the previous section.<function-name>
and <dead-letter-queue-arn>
with the appropriate values.Verify that the dead-letter queue configuration is successful by checking the Lambda function's details or using the AWS CLI.
Retest the Lambda function to ensure that any failed invocations are sent to the configured dead-letter queue for error handling and troubleshooting purposes.
Note: It is essential to ensure that the designated dead-letter queue has proper permissions in place, granting Lambda write access to the queue.