I am currently working on a project, which involves a Lambda (Master-)function to manage different other things.
- It has an S3 trigger
- calls another Lambda function (SubLambda1) which makes a AWS Textract call
- calls another Lambda function (SubLambda2) which makes some AWS Bedrock calls
- it also retrieves and updates information in a MYSQL AWS RDS server
When I run the database publicly accessible, everything works, no problem.
When I emulate the Masterlambda on my home PC, with my IP as exception within the databases Security Group but otherwise no public internet access. This also works.
But when i want the MasterLambda to have access to a non public DB I have to add the DB to the Lambda, which puts the Lambda into the same VPC as the DB and cuts it off from public access. As a result, the Master Lambda cant communicate with the Sublambdas anymore.
I tried to put the Sublambdas into the same VPC, but without success. And even if this would work, would the Sublambdas still be able to make calls to Bedrock and Textract, or would they be cut off and timeout too?
The base problem here is that the DB should not be accessible from anywhere in the internet (pw is seemingly not enough)
2
Answers
Okay, I figured it out, here is how to do it:
I think If you put lambdas and sublamdas with the DB in internal VPC (no internet access) you will have to create VPC Endpoints for (RDS, Textract and bedrock).
For VPC Endpoint bedrock:
https://docs.aws.amazon.com/bedrock/latest/userguide/vpc-interface-endpoints.html