Ensure Lambda functions comply with using the latest runtimes.
Rule | Lambda functions should use latest runtimes |
Framework | AWS Foundational Security Best Practices |
Severity | ✔ Medium |
Rule Description
AWS recommends using the latest runtimes for Lambda functions to ensure the best security practices are in place. Keeping the runtimes up to date is important as new versions often include security patches and bug fixes, reducing the risk of vulnerabilities.
Troubleshooting Steps
Necessary Codes
There are no specific codes required as part of this rule. However, the following example demonstrates how to update the function's runtime version using the AWS CLI.
Step-by-Step Guide for Remediation
Open the AWS Management Console or access the AWS CLI.
Identify the name of the Lambda function that needs its runtime upgraded.
function-name
with the actual name of the Lambda function:
aws lambda get-function --function-name function-name
Once you have identified the current runtime version, check the AWS Lambda runtime release notes to determine the latest available version: https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html
Verify if the function's compatibility and dependencies allow for an upgrade to the latest runtime version.
Update the runtime version with the following command:
Runtime
configuration to the latest version.function-name
and runtime-version
with the actual function name and latest runtime version:
aws lambda update-function-configuration --function-name function-name --runtime runtime-version
Observe any impact on the function's functionality after the runtime version is updated. Test and verify that all desired behaviors are still functioning as expected.
Monitor the function's logs and metrics to ensure there are no new errors or abnormalities caused by the runtime upgrade.
Repeat the above steps periodically to ensure the Lambda function is always using the latest runtime version.
By following these steps and keeping your Lambda function's runtime up to date, you can adhere to AWS's Foundational Security Best Practices and maintain a secure serverless environment.