Christopher Zerbe
Christopher Zerbe

Reputation: 23

AWS Connection error to Endpoint URL for Rekognition

I have just started with AWS Rekognition and I have run into a problem that I can't seem to solve.

I am using the Python script supplied on Detecting Text in an Image - Amazon Rekognition to test how the service works and how I could possibly integrate it into other apps.

I know that I have entered the correct data for the config and credential files, found here:

~/.aws/credentials

as other services such as S3 work without a problem using command line code. In the supplied code (I will include it at the end) I have specified the correct bucket as well as the name of the picture I'm trying to use. When running the script, on terminal everything works fine until after a few seconds the following error message is displayed:

botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint 
 URL: "https://rekognition.eu-west-2.amazonaws.com/"

I have also tried several other availability zones such as:

us-east-1, us-west-1, eu-central-1

yet they all result in the same error.

A similar issue has already been discussed in python - botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint - Stack Overflow. However, the solution offered in that discussion did not solve the problem I am encountering. I would appreciate any help and tips that can solve this issue.

import boto3

bucket='bucket'
photo='inputtext.jpg'

client=boto3.client('rekognition')

response=client.detect_text(Image={'S3Object':{'Bucket':bucket,'Name':photo}})

textDetections=response['TextDetections']
print response
print 'Matching faces'
for text in textDetections:
        print 'Detected text:' + text['DetectedText']
        print 'Confidence: ' + "{:.2f}".format(text['Confidence']) + "%"
        print 'Id: {}'.format(text['Id'])
        if 'ParentId' in text:
            print 'Parent Id: {}'.format(text['ParentId'])
        print 'Type:' + text['Type']
        print

Upvotes: 2

Views: 1479

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269330

Your code worked perfectly fine for me.

I connected to the Sydney region:

client=boto3.client('rekognition',region_name='ap-southeast-2')

Please note that the supported regions for Amazon Rekognition are (as of writing this answer):

  • us-east-2
  • us-east-1
  • us-west-2
  • ap-southeast-2
  • ap-northeast-1
  • eu-west-1

Upvotes: 2

Related Questions