How to attach a VPC to a Lambda through fromFunctionAttributes in CDK?

I manage infrastructure through CDK, except for stuff created by zappa for a Django application.

Now, I need to connect such Lambda to the RDS cluster: following this guide I need to attach the Lambda to RDS's VPC, assign all subnets and use a SG different than RDS VPC.

However, if can retrieve Zappa's Lambda only through Function.fromFunctionAttributes() which doesn't allow then to specify the vpc as we would create the Lambda inside CDK.

How do I solve this?

Вернуться на верх