Skip to content

Assistance with AWS Lambda Node.js 20.x end-of-life for AWS-supported static website stack

0

Hi, two months ago I deployed this AWS solution for a cloudfront secure static site: https://github.com/aws-samples/amazon-cloudfront-secure-static-site . The deployment succeeded and my website works. However, I just received an AWS Health Event "[Action Required] AWS Lambda Node.js 20.x end-of-life". This is because a lambda deployed in the static site setup stack has Node.js 20.x runtime. I am receiving daily emails about this. How do I correctly update the stack to remediate this issue?

asked 15 days ago70 views
3 Answers
1

The AI-generated advice is a good starting point, but since you are using a specific AWS Sample (CDK-based), the most robust way to fix this is to update the source code rather than editing the CloudFormation stack manually.

  1. Update your local repository: Run git pull to see if the maintainers have already updated the runtime to Node.js 22.x.

  2. Manual Code Change: If not updated, search your project (likely in the /lib folder) for runtime: lambda.Runtime.NODEJS_20_X and change it to lambda.Runtime.NODEJS_22_X.

  3. Redeploy: Run cdk deploy from your terminal. This ensures your infrastructure-as-code stays in sync with your deployed resources and correctly handles the versioning required for Lambda@Edge.

  4. Verify: Check the CloudFront headers after deployment to ensure the function is still executing correctly.

Updating via the CDK/source code is preferred over manual console edits to prevent "configuration drift" in your stack.

EXPERT
answered 15 days ago
0

To remediate the AWS Lambda Node.js 20.x runtime deprecation issue in your CloudFormation stack, you'll need to update the Lambda function's runtime to a supported version. Here's how to correctly update your stack:

  1. Locate your CloudFormation stack: Find the stack that was deployed for your secure static website solution in the AWS CloudFormation console.

  2. Modify the template: You need to update the CloudFormation template to change the "Runtime" property in the Lambda function resource from Node.js 20.x to a currently supported Node.js runtime version. Look for the Lambda function resource in your template and update the runtime parameter.

  3. Update the stack: Use the modified template to update your existing CloudFormation stack. This will apply the runtime change to your Lambda function.

  4. Assess dependencies: When upgrading Lambda function runtimes, ensure that all dependencies are compatible with the new runtime version. If your function uses Lambda layers, make sure they are created on the same operating system as the target runtime.

  5. Validate your template: Consider using cfn-lint to validate your CloudFormation template before applying the update to catch any potential issues.

AWS periodically deprecates older runtimes to ensure security compliance, maintain performance standards, and provide access to the latest language features and security patches. The deprecation notifications you're receiving are sent at least 180 days before a runtime is deprecated to give you time to upgrade. Once deprecated, the runtime is no longer eligible for security updates, so it's important to upgrade to a supported version promptly.
Sources
How should I Create/Update Deprecated Runtime in AWS Lambda functions using CloudFormation | AWS re:Post
Lambda runtimes - AWS Lambda

answered 15 days ago
EXPERT
reviewed 15 days ago
0

You should update the Lambda to the latest supported version like nodejs24. I usually double check the code using Claude or ChatGPT which gives you advice on whether you will need to change the code or keep as is. Note, you might need to update the packages as well.

EXPERT
answered 15 days ago
EXPERT
reviewed 15 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.