1

i'm trying to use the recognition service from aws. Image was successfully taken and uploaded to S3. However unable to do the recognition due to some end point url. I check this, and my region was correct.

Error Message:botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://rekognition.us-east-2.amazonaws.com/"

Look through the doc know that my end point should be something like s3-us-east-2.amazonaws.com.

Sorry I am new to this, please feel free to point out any mistake had made. Thanks in advance

python

def detect_labels(bucket, key, max_labels=10, min_confidence=90, region="us-
east-2"):
  rekognition = boto3.client("rekognition",region) #tried change rekognition to s3
  response = rekognition.detect_labels(
    Image={
      "S3Object": { 
        "Bucket": bucket,
        "Name": key,
      }
      },
    MaxLabels=max_labels,
    MinConfidence=min_confidence,
  ) 
  return response['Labels']

takePhoto(file_path, file_name)
uploadToS3(file_path,file_name, BUCKET,location)
for label in detect_labels(BUCKET,file_name):
  print("{Name} - {Confidence}%".format(**label))
aaa
  • 857
  • 4
  • 25
  • 46

1 Answers1

0

Amazon Rekognition is only available in three regions, currently: us-east-1, us-west-2, and eu-west-1.

http://docs.aws.amazon.com/general/latest/gr/rande.html#rekognition_region

Your bucket needs to be located in the region where you are using Rekognition.

Michael - sqlbot
  • 169,571
  • 25
  • 353
  • 427