- 最新
- 投票最多
- 评论最多
Hello, I think there are two mis-configurations.
- region name : us-east-1 (not east-us-1)
- 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
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. :)
相关内容
- AWS 官方已更新 3 个月前
- AWS 官方已更新 2 个月前
- AWS 官方已更新 3 个月前
- AWS 官方已更新 3 个月前