Access to S3 via AWS programmatic access -Boto3

0

Enter image description here Enter image description here

user (iamboto3) has full access Please your support

2 Antworten
1

You probably mean "us-east-1".

EXPERTE
beantwortet vor einem Jahr
profile pictureAWS
EXPERTE
überprüft vor einem Jahr
0

Hello, I think there are two mis-configurations.

  1. region name : us-east-1 (not east-us-1)
  2. output : json (not jason)

You can fix those configuration via this command sample.

$ aws configure --profile [your profile name]

If you want change configuration of iamboto3 profile, you should update [your profile name] in command sample to iamboto3.

And if you want to list up your whole S3 buckets, then I want to notice you just onemore thing.

in your code,

for each in security_tester_client.list_buckets():
    print(each)

then, the results will be shown below

Enter image description here

Because, "list_buckets" API's response syntax is like below. (cf . https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3/client/list_buckets.html)

{
    'Buckets': [
        {
            'Name': 'string',
            'CreationDate': datetime(2015, 1, 1)
        },
    ],
    'Owner': {
        'DisplayName': 'string',
        'ID': 'string'
    }
}

So, If you want to list up your buckets then, I suggest to correct your code like below.

for each in security_tester_client.list_buckets()["Buckets"]:
    print(each)

Then, you can successfully list up your S3 buckets via boto3.

If you like my answer, please accept my answer. Thank you. :)

beantwortet vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen