Upgrading AWS Lambda to Node@18

Ikechi Michael
2 min readMar 1


So you have AWS Lambda in production, using one of Node 14 or 16 versions, and you want to upgrade to the new Node@18 Runtimes?


We want readers to know what they have to do when upgrading their AWS Lambda to the Node@18 runtime via a checklist.


  1. Upgrade your local NodeJS runtime to version 18 either by directly downloading from nodejs.org, or using nvm. As at the time of writing this, node 18.14.2 is the LTS version.
  2. Run npm install to get the new version of package-lock.json
  3. Add an engines field to the package.json to prompt when an unsupported node version is used to access the project.
  4. Update your AWS Lambda config to use the nodejs18.x runtime. If you use cloudformation, this means changing to "Runtime": "nodejs18.x".
  5. Update your CI/CD pipelines to build with node version 18.14.2 .
  6. If you use Webpack, I’ve found webpack 5.75 works great for building project written for node@18.
  7. If your project uses aws-sdk v2, you will want to consider that the AWS lambdanodejs18.x runtime comes built-in with version 3.188.0 of the aws-sdk, which is v3, so you need to make a decision about your projects. Don’t worry, I’ve got you.

Upgrade aws-sdk to V3

You can find aws-sdk v3 packages by searching for @aws-sdk/client- on npm.

If you upgrade your aws-sdk from v2 to v3, then you can take advantage of using the exact 3.188.0 version of the @aws-sdk/* packages built-in with the AWS Lambda nodejs18.x runtime.

This means that you can bundle your code to not include the @aws-sdk/* packages with webpack externals or equivalent in other bundlers, keeping your bundle size small, which has its advantages.

externals: {
"@aws-sdk/client-ses": "@aws-sdk/client-ses"

However, if you must use a higher sdk version than the built-in 3.188.0 version, then you will want to include your sdk code in your bundle, which will increase your bundle size, and you may run into bundling errors such as it not being able to resolve the aws-crt module, which can be fixed by installing the aws-crt module.

Staying with aws-sdk V2

If you stay with the v2 of the aws-sdk, then you will have to bundle it with your code. This will increase your bundle size.

End-to-end test everything

So you’ve successfully upgraded your AWS Lambda runtime to nodejs18.x , and you have successfully deployed it to the cloud. Now, you need to test everything, to be sure nothing is broken.

Thanks for reading this. If there are steps you have found that I have not included in this article, please let me know the comments.

Have fun, coding!



Ikechi Michael

I’ve learned I don’t know anything. I've also learned that people will pay for what I know. Maybe that's why they never pay.