简体   繁体   中英

How does Lambda within subnet access VPC endpoint?

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.

why Case 2 is OK

VPC interface endpoints have vpc scope , not subnet scope. This explains why cases 2,1 and 4 work. Because of that, case 3 should also work. Thus, the question is why case 3 did not work?

Possible reasons are that in your tests you made some configuration mistake (wrong security group, for example), or put lambda in a wrong VPC, did not enable Private DNS for the endpoint. Thus I would recommend double checking all the configurations for Case 3 and re-run the experiment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM