title: StartQueryExecution operation: Unable to verify/create output bucket
body: <p>I am trying to execute query on Athena using python.</p>
  <p>Sample code</p>
  <pre><code>   client = boto3.client(
          'athena', 
          region_name=region,
          aws_access_key_id=AWS_ACCESS_KEY_ID,
          aws_secret_access_key=AWS_SECRET_ACCESS_KEY
      )
      execution = client.start_query_execution(
          QueryString=query,
          QueryExecutionContext={
              'Database': database
          },
          WorkGroup=workgroup,
          ResultConfiguration={
              'OutputLocation': S3_OUTPUT_LOCATION
          }
      )
  
  </code></pre>
  <p>This is working code, But I got an unusual scenario.</p>
  <ul>
  <li>One day it throws an InvalidRequestException error
  Error</li>
  </ul>
  <pre><code>InvalidRequestException: An error occurred (InvalidRequestException) when calling the StartQueryExecution operation: Unable to verify/create output bucket &lt;BUCKET NAME&gt;
  </code></pre>
  <ul>
  <li>As per the DevOps application have all the permission, It should work.</li>
  <li>We try to execute the same query on the AWS Athena console(Query editor). There it is working.</li>
  <li>Then we re-run the python script, it is not throwing any error.</li>
  <li>But on the next day, the python script start's throwing the same InvalidRequestException error.</li>
  <li>Then we execute the same query on the AWS Athena console(Query editor) and re-run the python script, it started working.</li>
  </ul>
  <p>We observed this scenario for a few days, Every 24 hours python script throws the error then we execute the query on the Athena console(Query editor) and re-run the python script.
  I don't understand why it is happening, is there any permission issue.</p>
  <p>Permissions:</p>
  <pre><code>{
      &quot;Version&quot;: &quot;2012-10-17&quot;,
      &quot;Statement&quot;: [
          {
              &quot;Sid&quot;: &quot;VisualEditor0&quot;,
              &quot;Effect&quot;: &quot;Allow&quot;,
              &quot;Action&quot;: [
                  &quot;s3:GetObject&quot;,
                  &quot;athena:GetWorkGroup&quot;,
                  &quot;athena:StartQueryExecution&quot;,
                  &quot;athena:ListDatabases&quot;,
                  &quot;athena:StopQueryExecution&quot;,
                  &quot;athena:GetQueryExecution&quot;,
                  &quot;athena:GetQueryResults&quot;,
                  &quot;athena:GetDatabase&quot;,
                  &quot;athena:GetDataCatalog&quot;,
                  &quot;athena:ListQueryExecutions&quot;,
                  &quot;s3:ListBucket&quot;
              ],
              &quot;Resource&quot;: [
                  &quot;arn:aws:s3:::&lt;BUCKET NAME&gt;&quot;,
                  &quot;arn:aws:s3:::&lt;BUCKET NAME&gt;/*&quot;,
              ]
          },
          {
              &quot;Sid&quot;: &quot;VisualEditor1&quot;,
              &quot;Effect&quot;: &quot;Allow&quot;,
              &quot;Action&quot;: [
                  &quot;s3:PutObject&quot;,
                  &quot;s3:GetObject&quot;,
                  &quot;s3:ListBucket&quot;,
                  &quot;athena:UpdateWorkGroup&quot;,
              ],
              &quot;Resource&quot;: [
                  &quot;arn:aws:s3:::&lt;BUCKET NAME&gt;/*&quot;,
                  &quot;arn:aws:s3:::&lt;BUCKET NAME&gt;&quot;,
                  &quot;arn:aws:athena:*:&lt;BUCKET NAME&gt;/&lt;PATH&gt;&quot;,
              ]
          },
          {
              &quot;Sid&quot;: &quot;VisualEditor2&quot;,
              &quot;Effect&quot;: &quot;Allow&quot;,
              &quot;Action&quot;: [
                  &quot;athena:ListDataCatalogs&quot;,
                  &quot;s3:ListAllMyBuckets&quot;
              ],
              &quot;Resource&quot;: &quot;*&quot;
          }
      ]
  }
  </code></pre>