'Lambda subnet setting to fetch the access to RDS

I have two pair of Lambda and Gataway, one ECS and one RDS

Lambdas and ECS needs to access RDS

My first idea is put everything in Public, because this is the test server, so I want to make it cheap as possible.

However, lambda requires to be put in Public for internet access.

So I made the private isolated subnets then put lambda in Private Isolated

However when accessing from Lambda to RDS, it got stuck and timeout ( it access to the secret manager and then RDS)

My idea is wrong? or what subnets should I set??

Lambda - Private Isolated
ECS - Public
RDS - Public


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source