Skip to content

Lambda End-of-life Runtime

Level: Error

Initial version: 0.1.7

cfn-lint: E2531

tflint: aws_lambda_function_eol_runtime

Managed Lambda runtimes for .zip file archives are built around a combination of operating system, programming language, and software libraries that are subject to maintenance and security updates. When security updates are no longer available for a component of a runtime, Lambda deprecates the runtime.

Info

This rule is implemented natively in cfn-lint as rule number E2531.

Implementations

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
import { Code, Function, Runtime } from '@aws-cdk/aws-lambda';

export class MyStack extends cdk.Stack {
  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const myFunction = new Function(
      scope, 'MyFunction',
      {
        code: Code.fromAsset('src/hello/'),
        handler: 'main.handler',
        // Select a runtime that is not deprecated
        runtime: Runtime.PYTHON_3_8,
      }
    );
  }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
{
  "Resources": {
    "MyFunction": {
      "Type": "AWS::Serverless::Function",
      "Properties": {
        "CodeUri": ".",
        // Select a runtime that is not deprecated
        "Runtime": "python3.8",
        "Handler": "main.handler"
      }
    }
  }
}
1
2
3
4
5
6
7
8
Resources:
  MyFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: .
      # Select a runtime that is not deprecated
      Runtime: python3.8
      Handler: main.handler
1
2
3
4
5
6
7
8
provider:
  name: aws
  # Select a runtime that is not deprecated
  runtime: nodejs14.x

functions:
  hello:
    handler: handler.hello
1
2
3
4
5
6
7
resource "aws_lambda_function" "this" {
  function_name = "my-function"
  # Select a runtime that is not deprecated
  runtime       = "python3.8"
  handler       = "main.handler"
  filename      = "function.zip"
}

See also