How to connect the Lambda function to the default VpcConfig ?

0

Description:

My project exist exists in one single VPC (default one) (account created way after 2013) I have a Lambda function that requests successfully data from a DynamoDB table. I created a DAX cache Layer (which was created in the same default VPC) For the Lambda function to be able successfully query DAX, instead of the DynamoDB I should configure its VpcConfig. I manage my services using cloud formation (JSON) - Amplify CLI

Question

I can hardcode the SecurityGroupIds and SubnetIds in the lambda VpcConfig and it works fine. But I want a way to retrieve these values dynamically (This cloud formation will be also used in different environments) from the default VPC Usually when I need a specific ARN or Name I just put it in the Outputs of the created resources and use it elsewhere But in my case I didn't create the default VPC (It's automatically created when the account was created)

1개 답변
1
수락된 답변

Why not create a VPC in your CloudFormation template that is used by your application? You don't have to use the default VPC - and creating a new VPC will give you the flexibility to share the resource with other stacks.

Another alternative would be to put the default VPC identifier in Parameter Store and reference it from there.

profile pictureAWS
전문가
답변함 2달 전
profile pictureAWS
전문가
검토됨 2달 전
  • My idea was to use the already existing default VPC instead of creating a new one. And I found it a bit weird that I'm not able to reference it in my stacks. But yes, you're right I will simply create a new VPC and reference it in my application. Thank you!

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠