xxxxxxxxxx
import boto3
session = boto3.Session()
s3_client = session.client('s3')
b = s3_client.list_buckets()
for item in b['Buckets']:
print(item['Name'])
xxxxxxxxxx
aws s3 ls s3://bucketname --recursive --human-readable --summarize
Code language: Shell Session (shell)