title: AWS Boto3: Access denied while running in Django Server
body: <p>My textract code is successfully working when running in its own file, however, when I try to run it in my django development server, the authentication stops working.</p>
  <p>I recieve this exception:</p>
  <pre><code>botocore.errorfactory.InvalidS3ObjectException: An error occurred (InvalidS3ObjectException) when calling the StartDocumentAnalysis operation: Unable to get object metadata from S3. Check object key, region and/or access permissions.
  </code></pre>
  <p>So far, I have tried:</p>
  <ol>
  <li>Passing credentials as parameters in the boto.client() method</li>
  <li>Assuming a role, rather than using IAM user credentials</li>
  <li>Verified the object key, and region</li>
  <li>Checked my firewall</li>
  </ol>
  <p>Here is my authentication format:</p>
  <pre><code>client = boto3.client('sts', region_name=&quot;us-east-2&quot;) # Assumes a role.
  response = client.assume_role(
      RoleArn='arn:aws:iam::xxx:role/xxx/xxx',
      RoleSessionName = 'djangoBoto3',
      DurationSeconds = 3600,
  )
  textract = boto3.client( # Instantiate the textract client
      &quot;textract&quot;, 
      region_name=&quot;us-east-2&quot;,
      aws_access_key_id = response['Credentials']['AccessKeyId'],
      aws_secret_access_key = response['Credentials']['SecretAccessKey'],
      aws_session_token = response['Credentials']['SessionToken']
  )
  </code></pre>
  <p>Here is how I am calling the textract function</p>
  <pre><code>response = textract.start_document_analysis(
      DocumentLocation = {
          'S3Object':{
              'Bucket': bucket,
              'Name': key,
          }
      },
      FeatureTypes = ['TABLES', 'FORMS']
  )
  </code></pre>
  <p>Some AWS API calls are working within Django. For example I can upload files to S3 buckets. This leads me to suspect maybe this could be a signature issue. I read here <a href="https://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html" rel="nofollow noreferrer">Amazon Docs</a> that certain AWS operations such as S3 can work without a signature.</p>