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 Answers
1

You probably mean "us-east-1".

EXPERT
answered a year ago
profile pictureAWS
EXPERT
reviewed a year ago
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. :)

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions