Lambda to RDS Connectivity

0

Hi, I'm wanting to establish connectivity to an RDS instance from some Lambda functions. Lambda functions are autodeployed with serverless framework, so ideally my config would be dynamic. I am currently managing infrastructure with CDK, and have the following resources:

  1. RDS on Private Isolated subnet in VPC A, managed by CDK
  2. EC2 instance on public subnet in VPC A, managed by CDK (For access to the RDS from the wider internet)
  3. (Backend) 4 Lambdas without a VPC (Public), behind an API Gateway in default VPC, managed by serverless deploy
  4. Frontend hosted on S3 behind Cloudfront, managed by serverless deploy

I'm a bit stumped because I don't want to update my CDK script whenever the lambdas change. Help is much appreciated.

1개 답변
0
수락된 답변

There is no need to update the CDK scripts. All you need to do is attach the functions to some private subnets in the same VPC. Look at this to find out how to reference a CloudFormation Output in your serverless yaml.

profile pictureAWS
전문가
Uri
답변함 2년 전
profile picture
전문가
검토됨 한 달 전
  • Am I ok to put them in the same Private Isolated subnet as the RDS? Otherwise I can create private subnets on the VPC and put them there. How do I then allow access to the RDS?

  • I think it would be better to attach the functions to different subnets in the same VPC. In the RDS security group reference the Lambda security group to allow access.

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

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

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

관련 콘텐츠