Skip to content

Latest commit

 

History

History
42 lines (31 loc) · 1.36 KB

README.md

File metadata and controls

42 lines (31 loc) · 1.36 KB

cdk-lambda-runtime-hacker

npm GitHub package.json dynamic NPM

For hacking Lambda runtime versions in CDK

Note that this is definitely not safe in general. You might find that your code runs fine in the new runtime.

import { cdkLambdaRuntimeHack } from 'cdk-lambda-runtime-hacker';

...

const app = new cdk.App();

// Then attach things to app, like stacks, with constructs and Lambda functions

// Then force all uses of node10 Lambda runtimes to become node12, and
// hope that you don't get any bugs
cdkLambdaRuntimeHack(app, {
    maps: [{
        runtimeFrom: lambda.Runtime.NODEJS_10_X,
        runtimeTo: lambda.Runtime.NODEJS_12_X,
    }],
});

CDK v1 and v2

The export from the top level is for CDK v2. However, you can import an equivalent function that works with CDK v1 as follows:

import { cdkLambdaRuntimeHack } from 'cdk-lambda-runtime-hacker/cdkv1';

And, for consistency, CDK v2 is available as follows too:

import { cdkLambdaRuntimeHack } from 'cdk-lambda-runtime-hacker/cdkv2';