thenotoriousb
thenotoriousb

Reputation: 17

An error occurred (AccessDenied) when calling the ListBuckets operation: Access Denied

I'm working to in a project and the goal is to pull report from amazon S3. Currently I'm trying to access to an S3 location to check my available bucket list.

Im working in python, I've set all my credentials in the prompt : aws configure.

In my python file when i'm try the code to list all my bucket :

import boto3
s3 = boto3.resource('s3')
for bucket in s3.buckets.all():
    print (bucket.name)

I'm getting this error :

Traceback (most recent call last): File "C:\Users\bakpovo\testAmazon.py", line 3, in for bucket in s3.buckets.all(): File "C:\Users\bakpovo\AppData\Local\Programs\Python\Python38\lib\site-packages\boto3\resources\collection.py", line 83, in iter for page in self.pages(): File "C:\Users\bakpovo\AppData\Local\Programs\Python\Python38\lib\site-packages\boto3\resources\collection.py", line 161, in pages pages = [getattr(client, self._py_operation_name)(**params)] File "C:\Users\bakpovo\AppData\Local\Programs\Python\Python38\lib\site-packages\botocore\client.py", line 276, in _api_call return self._make_api_call(operation_name, kwargs) File "C:\Users\bakpovo\AppData\Local\Programs\Python\Python38\lib\site-packages\botocore\client.py", line 586, in _make_api_call raise error_class(parsed_response, operation_name) botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the ListBuckets operation: Access Denied

Does someone have any idea of what happened? Are my creadentials not good?

Thanks

Upvotes: 1

Views: 3501

Answers (1)

thenotoriousb
thenotoriousb

Reputation: 17

Thanks you all for your answer. I solve my problem. I have just add to my shell syntax my s3 location like this :

aws s3 ls s3://aps-external-xxxx/aps-downloadxxx-xxx-e306fd2/

And it's work.

Upvotes: -1

Related Questions