title: Why do I get ThrottlingException - Rate Exceeded status:400 when making AWS Athena API call from API server?
body: <p>We have an S3 data lake in AWS (with Lake Formation, Glue etc.) The end goal is to query the S3 data sources using SQL in Athena.</p>
  <ul>
  <li>When making the query in the AWS Athena console - everything works
  fine, results are provided,see screenshot: <a href="https://share.getcloudapp.com/NQuNBr5g" rel="nofollow noreferrer">https://share.getcloudapp.com/NQuNBr5g</a></li>
  <li>When making the query through the official API
  application domain (Symfony5 RESTful api that uses aws-sdk-php vendor), the
  query doesn't even get to Athena, error returned is 400: <a href="https://share.getcloudapp.com/xQuqQLrq" rel="nofollow noreferrer">https://share.getcloudapp.com/xQuqQLrq</a>
  <ul>
  <li>in CloudTrail events, I can only see
  errorcode= ThrottlingException and errormessage='Rate exceeded', there's no query execution id.</li>
  </ul>
  </li>
  <li>Weird thing I don't get is, when making the same call in my localhost setup of the API app, the call is again successful: <a href="https://share.getcloudapp.com/jkuv8ZGy" rel="nofollow noreferrer">https://share.getcloudapp.com/jkuv8ZGy</a></li>
  </ul>
  <p>The call made is StartQueryExecution on Athena API, error as shown on the API app's side:</p>
  <p><code>Error executing \&quot;GetQueryExecution\&quot; on \&quot;https://athena.us-west-2.amazonaws.com\&quot;; AWS HTTP error: Client error: `POST https://athena.us-west-2.amazonaws.com` resulted in a `400 Bad Request` response:\n{\&quot;__type\&quot;:\&quot;ThrottlingException\&quot;,\&quot;message\&quot;:\&quot;Rate exceeded\&quot;}\n ThrottlingException (client): Rate exceeded - {\&quot;__type\&quot;:\&quot;ThrottlingException\&quot;,\&quot;message\&quot;:\&quot;Rate exceeded\&quot;}&quot;, &quot;class&quot;: &quot;Aws\\Athena\\Exception\\AthenaException&quot;</code></p>
  <p>The API app server and the datalake etc. are on the same VPC, and I created a VPC endpoint from the server's VPC to athena us-west-2 endpoint, but it didn't help. I don't think it's Athena Quota issues, since on localhost the query works just fine. Any insight would be very helpful, thank you!</p>