AWS CLI S3 List
aws s3api list-buckets --query "Buckets[].Name"
Eager Echidna
aws s3api list-buckets --query "Buckets[].Name"
aws s3api list-buckets --query "Buckets[].Name"
# Retrieve the list of existing buckets
s3 = boto3.client('s3')
response = s3.list_buckets()
# Output the bucket names
print('Existing buckets:')
for bucket in response['Buckets']:
print(f' {bucket["Name"]}')