OiO.lk Blog python botocore.errorfactory.AccessDeniedException: An error occurred (AccessDeniedException) when calling the GetCelebrityInfo operation:
python

botocore.errorfactory.AccessDeniedException: An error occurred (AccessDeniedException) when calling the GetCelebrityInfo operation:


I’m trying to run some of the rekognition examples from the "amazon-rekognition-developer-guide" github repo.

I’ve created a user account with full Rekognition access and set the profile as per the instructions and can run the "python-detect-faces.py" on an image in an S3 bucket, but when I go to test others, I get an access denied error. Others like client.recognize_celebrities also return this same error, but I’m at a loss to understand why since I’ve given the account full Rekognition access.

#Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)

import boto3

if __name__ == "__main__":

    id="nm0000234"
    
    client=boto3.client('rekognition')

    #Display celebrity info
    print('Getting celebrity info for celebrity: ' + id)
    response=client.get_celebrity_info(Id=id)

    print (response['Name'])  
    print ('Further information (if available):')
    for url in response['Urls']:
        print (url) 

Result:

(celeb-rekognition) user@2m7x6m3:~/Code/MachineLearning/Amazon/amazon-rekognition-developer-guide/code_examples/python_examples/image$ python python-get-celebrity-info.py 
Getting celebrity info for celebrity: nm0000234
Traceback (most recent call last):
  File "/media/user/MACHLEARN/user/Code/MachineLearning/Amazon/amazon-rekognition-developer-guide/code_examples/python_examples/image/python-get-celebrity-info.py", line 14, in <module>
    response=client.get_celebrity_info(Id=id)
  File "/home/user/anaconda3/envs/celeb-rekognition/lib/python3.10/site-packages/botocore/client.py", line 569, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/home/user/anaconda3/envs/celeb-rekognition/lib/python3.10/site-packages/botocore/client.py", line 1023, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.AccessDeniedException: An error occurred (AccessDeniedException) when calling the GetCelebrityInfo operation: 
(celeb-rekognition) user@2m7x6m3:~/Code/MachineLearning/Amazon/amazon-rekognition-developer-guide/code_examples/python_examples/image



You need to sign in to view this answers

Exit mobile version