I have a lambda function within a VPC that rotates rds password. When I test lambda function with secret manager vpc endpoint as following:
- Case 1. Lambda in public subnet - VPC endpoint attach with public subnet => Rotation is OK
- Case 2. Lambda in private subnet - VPC endpoint attach with public subnet => Rotation is OK although cloudwatch has one error.
- Case 3. Lambda in public subnet - VPC endpoint attach with private subnet => Rotation is failed because timeout of lambda function
- Case 4. Lambda in private subnet - VPC endpoint attach with private subnet => Rotation is OK
I know I should not put the lambda function into public subnet but I want to know how lambda function within subnet works with vpc endpoint.
Can anyone explains why Case 2 is OK although lambda and vpc endpoint are in different subnets.