Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Integrating lambdas with existing VPC/Subnets #2168

Answered by dphang
mattguidone asked this question in Q&A
Discussion options

I was reading on the Serverless documents a method for attaching pre-existing VPC's to lambdas like so:

# serverless.yml
service: service-name
provider:
 name: aws
 vpc:
 securityGroupIds:
 - securityGroupId1
 - securityGroupId2
 subnetIds:
 - subnetId1
 - subnetId2
functions:
 hello: # this function will overwrite the service level vpc config above
 handler: handler.hello
 vpc:
 securityGroupIds:
 - securityGroupId1
 - securityGroupId2
 subnetIds:
 - subnetId1
 - subnetId2
 users: # this function will inherit the service level vpc config above
 handler: handler.users

Is it possible to specify and attach the lambdas that are generated from serverless-nextjs to a specific VPC and subnets?

EDIT

It's currently not possible to associate Lambda@Edge with a VPC. Better luck next time

You must be logged in to vote

Yes, currently Lambda@Edge is more limited, for example you cannot attach a VPC at the moment. But in the near future (hopefully by 1-2 months) I am working on adding Lambda support back again (Lambda + APIGatewayV2 + CloudFront) with proper IaC, so it should be potentially fully configurable at your end instead of the limited abstractions we provide via a serverless.yml file. For a preview (it's NOT production ready yet, you would need to hack things together to get it to work/deploy via CDK Terraform), you can check it out here: https://github.com/serverless-nextjs/serverless-next.js/tree/master/packages/libs/lambda and https://github.com/serverless-nextjs/serverless-next.js/blob/master...

Replies: 3 comments

Comment options

Yes, currently Lambda@Edge is more limited, for example you cannot attach a VPC at the moment. But in the near future (hopefully by 1-2 months) I am working on adding Lambda support back again (Lambda + APIGatewayV2 + CloudFront) with proper IaC, so it should be potentially fully configurable at your end instead of the limited abstractions we provide via a serverless.yml file. For a preview (it's NOT production ready yet, you would need to hack things together to get it to work/deploy via CDK Terraform), you can check it out here: https://github.com/serverless-nextjs/serverless-next.js/tree/master/packages/libs/lambda and https://github.com/serverless-nextjs/serverless-next.js/blob/master/packages/libs/lambda/src/deploy/cdktf/nextJsLambdaApp.ts

You must be logged in to vote
0 replies
Answer selected by dphang
Comment options

Hey @dphang any update on this? Interested on how this would work :)

You must be logged in to vote
0 replies
Comment options

Would love to hear more on this since.
use case being, If you have security requirements (SOC, HIPAA, PCI) requirements where lambdas must be on a VPC you can't use Edge lambdas.
Since they do not allow vpc deployment.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /