Lambda function should use the latest runtime environment version

このページは日本語には対応しておりません。随時翻訳に取り組んでいます。翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください。

WARNING: This rule is being deprecated on 27 March 2024 and will no longer be supported.

Description

Update your Amazon Lambda Function to the latest runtime environment version.

Rationale

As a best practice, Amazon recommends consistently updating your runtime environment to the latest version for security patches, bug fixes, and the latest features.

Note: AWS Lambda supports both container images and .zip file archives for the deployment package. When using an Image, the runtime is not accessible in the configuration data, as it is defined at the time of base image creation. This remains consistent across all three types of base images, AWS, and Custom. As a result, this configuration check only reports findings against Zip type deployment packages.

Remediation

From the console

Follow the Configuring functions in the console docs to learn how to update the Lambda runtime that runs your function.

From the command line

  1. Run update-function-configuration with your function name and the latest runtime version supported by AWS.

python3.9

update-function-configuration.sh

  aws lambda update-function-configuration
    --function-name YourLambdaFunction
    --runtime "python3.9"
  

nodejs18.x

update-function-configuration.sh

  aws lambda update-function-configuration
    --function-name YourLambdaFunction
    --runtime "nodejs18.x"
  

java11

update-function-configuration.sh

  aws lambda update-function-configuration
    --function-name YourLambdaFunction
    --runtime "java11"
  

go1.x

update-function-configuration.sh

  aws lambda update-function-configuration
    --function-name YourLambdaFunction
    --runtime "go1.x"
  

dotnet6

update-function-configuration.sh

  aws lambda update-function-configuration
    --function-name YourLambdaFunction
    --runtime "dotnet6"
  

ruby2.7

update-function-configuration.sh

  aws lambda update-function-configuration
    --function-name YourLambdaFunction
    --runtime "ruby2.7"
  

provided.al2

update-function-configuration.sh

  aws lambda update-function-configuration
    --function-name YourLambdaFunction
    --runtime "provided.al2"