title: AWS Rekognition gives an InvalidS3Exeption error
body: <p>Every time I run the command </p>
  
  <pre><code>aws rekognition detect-labels --image "S3Object={Bucket=BucketName,Name=picture.jpg}" --region us-east-1
  </code></pre>
  
  <p>I get this error.</p>
  
  <pre><code>InvalidS3ObjectException: An error occurred (InvalidS3ObjectException) when calling the DetectLabels operation: Unable to get image metadata from S3.  Check object key, region and/or access permissions.
  </code></pre>
  
  <p>I am trying to retrieve labels for a project I am working on but I can't seem to get past this step. I configured aws with my access key, secret key, us-east-1 region, and json as my output format.</p>
  
  <p>I have also tried the code below and I receive the exact same error (I correctly Replaced BucketName with the name of my bucket.)</p>
  
  <pre><code>import boto3
  
  BUCKET = "BucketName"
  KEY = "picture.jpg"
  
  def detect_labels(bucket, key, max_labels=10, min_confidence=90, region="eu-west-1"):
      rekognition = boto3.client("rekognition", region)
      response = rekognition.detect_labels(
          Image={
              "S3Object": {
                  "Bucket": bucket,
                  "Name": key,
              }
          },
          MaxLabels=max_labels,
          MinConfidence=min_confidence,
      )
      return response['Labels']
  
  
  for label in detect_labels(BUCKET, KEY):
      print "{Name} - {Confidence}%".format(**label)
  </code></pre>
  
  <p>I am able to see on my user account that it is calling Rekognition.
  <a href="https://i.stack.imgur.com/4p5j0.gif" rel="noreferrer">Image showing it being called from IAM.</a></p>
  
  <p>It seems like the issue is somewhere with my S3 bucket but I haven't found out what.</p>