How can I add an already existing VPC to a lambda using AWS CDK?

615 Views Asked by At

Currently I'm using AWS CDK to create a simple lambda function.

const hello = new Function(this,"HelloHandler",{
      role:lambdaRole,
      runtime:Runtime.NODEJS_16_X,
      code:Code.fromAsset("dist"),
      handler:"index.handler",
    }) 

I wish to add a VPC to the lambda. Normally one would need to create a VPC in the normal manner. However in my scenario, I wish to add a VPC that already exists and was created using the AWS console.

Is there a way to do so?

Note:

  • I'm using TypeScript
0

There are 0 best solutions below