title: Invoking a Lambda function from another Lambda Function Inside of a VPC
body: <p>I have been debugging, configuring and you name it the last couple of hours and i can't seem to figure out why this is happening.</p>
  
  <p>I am trying to invoke a lambda function which is just retrieving basic information from ec2. when i test this lambda function in the aws console it seems to be working fine. However, invoking it in another lambda, using following code;</p>
  
  <pre><code>    BasicAWSCredentials awsCreds = new BasicAWSCredentials("key1" , "key2");
      AWSLambdaClientBuilder builder = AWSLambdaClientBuilder.standard()
              .withRegion("eu-west-1")
              .withCredentials(new AWSStaticCredentialsProvider(awsCreds));
      AWSLambda client = builder.build();
  
      InvokeRequest req = new InvokeRequest()
              .withFunctionName("GetWhateverIneed");
      InvokeResult result = client.invoke(req);
  </code></pre>
  
  <p>it simply times out. No response whatsoever... Both Lambdas are connected to the VPC and all subnets</p>
  
  <p>I think it is my new VPC that is causing this problem. My VPC is consisting of:</p>
  
  <p>1 VPC .<br>
   -2x Subnets (1x Private with ipv4 10.0.0.0/17, 1x Public with ipv4 10.0.128.0/17).<br>
   -1x IGW Connected to the Private subnet.<br>
   -1x NAT Gateway connected to the Public subnet .<br>
   -2x Endpoints (One for Ec2, One for SecretsManager)</p>
  
  <p>I have also configured two route tables, 
  One for the "public" subnet:
  "Routes" -><br>
  Destination: 10.0.0.0/16 Target: local<br>
  Destination: 0.0.0.0/0 Target: My Internet Gateway(IGW)</p>
  
  <p>One for the "private" subnet:
  "Routes" -><br>
  Destination: 10.0.0.0/16 Target: local .<br>
  Destination: 0.0.0.0/0 Target: My nat</p>
  
  <p>I have made sure both of my Lambdas is running on the same VPC, they are both using the same security group:       <a href="https://i.stack.imgur.com/CXWOh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/CXWOh.png" alt="enter image description here"></a></p>
  
  <p>This is my first time working with VPC so it is possible that i have missed something. </p>