Skip to main content

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration “Lambda Functions Should Have Tracing Enabled” for AWS using the AWS console, follow the below steps:
  1. Open the AWS Lambda console.
  2. Select the Lambda function for which you want to enable tracing.
  3. Click on the “Configuration” tab.
  4. Scroll down to the “Debugging and error handling” section.
  5. Under “Debugging and error handling”, click on the “Edit” button.
  6. In the “Edit function” page, scroll down to the “Tracing” section.
  7. Under “Tracing”, select the “Active” option.
  8. In the “Tracing mode” drop-down, select the “AWS X-Ray” option.
  9. Click on the “Save” button at the top of the page to save the changes.
Once the above steps are completed, tracing will be enabled for the selected Lambda function in AWS.

To remediate the misconfiguration of Lambda Functions not having tracing enabled in AWS using AWS CLI, follow these steps:
  1. Open the AWS CLI on your local machine or EC2 instance.
  2. Run the following command to enable tracing on all Lambda functions in the AWS account:
  1. If you want to enable tracing only on specific Lambda functions, run the following command:
Replace <function-name> with the name of the Lambda function that you want to enable tracing on.
  1. Verify that tracing is enabled on the Lambda function by running the following command:
This command will return the configuration details of the Lambda function, including the tracing mode. If the tracing mode is set to “Active”, then tracing is enabled on the function.By following these steps, you can remediate the misconfiguration of Lambda Functions not having tracing enabled in AWS using AWS CLI.
To remediate the misconfiguration of Lambda Functions not having tracing enabled in AWS, you can follow the below steps using Python:
  1. Import the necessary AWS SDK libraries for Python:
  1. Create an AWS Lambda client object:
  1. List all the available Lambda functions:
  1. For each function, check if tracing is enabled or not:
  1. Save the Python script and execute it to enable tracing for all the available Lambda functions.
With the above steps, you can easily remediate the misconfiguration of Lambda Functions not having tracing enabled in AWS.
Changing tracing_config from PassThrough or unset to Active is an in-place update and does not replace the Lambda function, but it may incur additional AWS X-Ray costs.To verify, terraform plan should show an in-place update (~) on aws_lambda_function.THIS_FUNCTION changing tracing_config.mode to "Active" and (if newly added) creation (+) of the IAM role/policy attachment resources.