Documentation
README
Ensure that the runtime environment versions used for your Lambda functions do not have end of support dates
Description
Always using a recent version of the execution environment configured for your Amazon Lambda functions adheres to best practices for the newest software features, the latest security patches and bug fixes, and performance and reliability.
Rationale
When you execute your Lambda functions using recent versions of the implemented runtime environment, you should benefit from new features and enhancements, better security, along with performance and reliability.
Impact
Upgrading runtime versions may introduce breaking changes. Functions should be thoroughly tested with the new runtime before deployment.
Audit Procedure
Using AWS Console
- Login to the AWS Console using https://console.aws.amazon.com/lambda/.
- In the left column, under
AWS Lambda, clickFunctions. - Under
Function nameclick on the name of the function that you want to review - Click Code tab
- In the Runtime settings section, check the Runtime attribute value to determine the runtime version.
- Compare the function runtime with the updated list of Amazon Lambda runtimes. Link is in the resource section.
- If the version you are using is not the latest or is on the EOL list, the selected Amazon Lambda function is using an old and deprecated runtime environment.
- Refer to the remediation below.
- Repeat steps 2-6 for each Lambda function within the current region.
Then repeat the Audit process for all other regions.
Using AWS CLI
- Run
aws lambda list-functions
aws lambda list-functions --output table --query 'Functions[*].FunctionName'
This command will provide a table titled ListFunctions
- Run
aws lambda get-function-configurationusing the Function names returned in the table.
aws lambda get-function-configuration --function-name "name_of_fuunction" --query 'Runtime'
- The command output should return the execution environment.
- Compare the function runtime with the updated list of Amazon Lambda runtimes. Link is in the resource section.
- If the version you are using is not the latest or is on the EOL list, the selected Amazon Lambda function is using an old and deprecated runtime environment.
- Refer to the remediation below.
Expected Result
All Lambda functions use supported runtime versions that are not deprecated or on the end-of-life (EOL) list.
Remediation
Using AWS Console
- Login to the AWS Console using https://console.aws.amazon.com/lambda/.
- In the left column, under
AWS Lambda, clickFunctions. - Under
Function nameclick on the name of the function that you want to review - Click Code tab
- Go to the Runtime settings section.
- Click Edit
- On the Edit runtime settings page, select the latest supported version of the runtime environment from the dropdown list. **Note - make sure the correct architecture is also selected.
- Click Save
- Select the Code tab
- Click Test from the Code source section.
- Once the testing is completed, the execution result of your Lambda function will be listed
- Repeat steps for each Lambda function that failed the Audit within the current region.
Using AWS CLI
- Run
aws lambda update-function-configurationusing the name of the Function you need to remediate
aws lambda update-function-configuration --output table --query 'Functions[*].FunctionName'
This command will provide a table titled ListFunctions
- Run
aws lambda get-function-configurationusing the Function names returned in the table.
aws lambda get-function-configuration --function-name "name_of_fuunction" --function-name "name_of_function" --runtime "python3.9"
- The command output should return the metadata available for the reconfigured function.
- Repeat steps 1-2 to upgrade the runtime environment for each Amazon Lambda function found in the Audit.
Default Value
Lambda functions use the runtime version specified at creation time. AWS does not automatically upgrade runtimes.
References
CIS Controls
| Controls Version | Control | IG 1 | IG 2 | IG 3 |
|---|---|---|---|---|
| v8 | 7.4 Perform Automated Application Patch Management - Perform application updates on enterprise assets through automated patch management on a monthly, or more frequent, basis. | x | x | x |
| v7 | 3.5 Deploy Automated Software Patch Management Tools - Deploy automated software update tools in order to ensure that third-party software on all systems is running the most recent security updates provided by the software vendor. | x | x | x |
Profile
Level 1 | Manual