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

aasaad
已提问 1 年前296 查看次数
2 回答
1

You probably mean "us-east-1".

专家
已回答 1 年前
profile pictureAWS
专家
已审核 1 年前
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. :)

已回答 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则