I have created AWS Lambda to start and stop EC2 instances hosted in private VPC.
I could deploy the Lambda function in 'NO VPC' and perform action without any issues.
But when I deploy the Lambda function in the private VPC (where my EC2 is located) and 2 different subnets (in one of those subnet EC2 is launched) with necessary security group changes, I got timed out error and could not perform actions anymore.
Question: Is it necessary to add a NAT Gateway to Lambda, though there is no requirement of outer internet?
If yes, please let me know why.
If no, please let me know what else I have to check to get this process working.