title: Connecting to Aurora Serverless from Lambda Django?
body: <p>I want to connect to my Aurora Serverless mysql database inside of my django Lambda function. Currently, I have:</p>
  
  <ul>
  <li>a Lambda function inside of the default VPC
  
  <ul>
  <li>Uses the default security group</li>
  <li>Uses two public subnets I created</li>
  <li>Allows inbound requests from TCP ports 1024 - 65535</li>
  <li>Allows outbound requests to Aurora/Mysql on Aurora security group</li>
  </ul></li>
  <li>an Aurora cluster inside of the default VPC
  
  <ul>
  <li>Uses the same (default) VPC as the Lambda</li>
  <li>Uses two private subnets I created</li>
  <li>Allows inbound requests on port 3306 from Lambda security group</li>
  </ul></li>
  <li>an internet gateway for the default VPC</li>
  <li>a NAT gateway which pipes communications to the internet gateway</li>
  <li>a public routing table with the target ID of the internet gateway</li>
  <li>a private routing table with the target ID of the NAT gateway</li>
  </ul>
  
  <p>When I try to deploy my Lambda function to API gateway, the request times out:</p>
  
  <pre><code>START RequestId: [request id] Version: $LATEST
  Instancing..
  END RequestId: [request id]
  REPORT RequestId: [request id]  Duration: 30030.15 ms   Billed Duration: 30000 ms   Memory Size: 512 MB Max Memory Used: 49 MB  
  [time] [request id] Task timed out after 30.03 seconds
  
  </code></pre>
  
  <p>When I remove the Lambda function from the VPC (setting the VPC to none in the Lambda function's settings), it deploys to API gateway without any problems. This has led me to believe that my problem is with the VPC as opposed to with my database.</p>
  
  <p>I used <a href="https://stackoverflow.com/questions/39144688/aws-lambda-invoke-not-calling-another-lambda-function-node-js">this</a> question to try and rearrange the VPC to get it working but it has not worked.</p>
  
  <p>Any help with getting the API to run and connect to the Aurora serverless cluster or alternative ways to use a database with django and Lambda functions would be great. Thanks!</p>