skip to Main Content

Could you please help me understand how to specify the nodejs runtime version of the lambda function that gets automatically created by aws when a new data bucket with parameter
autoDeleteObjects: true is created?

I am using the following piece of code:

const autoDeleteBucketProps = { autoDeleteObjects: true, removalPolicy: >cdk.RemovalPolicy.DESTROY };

new Bucket(this, ‘store’, {
…bucketProps,
…autoDeleteBucketProps
});

This code automatically creates a lambda function with runtime version Node.js 12.x for autodeleting objects. However due to the fact that Amazon requires that we upgrade our lambda runtimes (ending support of v12 as described in Lambda runtime support policy), I am trying to a find a way to upgrade the runtime of this automatically created lambda to version 14.

I am using aws-cdk v1.152.0 which supports ‘@aws-cdk/aws-lambda’ Runtime version v14. So why this lambda gets created with runtime v12? And how can it can be changed to v14, programmatically?

Thank you in advance.

2

Answers


  1. I think you should be able to update the runtime in the console or remake the function when v12 is no longer used.

    You can find more details on the lambda runtimes here

    Login or Signup to reply.
  2. I just updated one of our stacks from CDK 2.23.0 to 2.46.0 and the auto deletion lambda automatically updated to Node 14 runtime.

    You said you were using CDK 1.152.0 and if for some reason you want to stick with V1, it should also update to the new runtime in 1.176.0, but I have not tested this myself. I was just reading the changelog notes of CDK.

    Updating to CDK v2 was quite easy for us at least and I think v1 is nearing end-of-life so I suggest you move to v2 now or soon.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search