You can use the below Python script to print all S3 buckets names in your AWS account.
Step 1: Install and configure Python boto3
https://cloudaffaire.com/how-to-install-python-boto3-sdk-for-aws/
https://cloudaffaire.com/how-to-configure-python-boto3-sdk-for-aws/
Step 2: Create a python script to print all S3 bucket names
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
## Create a python script to list all s3 buckets name cat << EOF > list_buckets.py import boto3 from botocore.exceptions import ClientError def list_buckets(): try: s3_client = boto3.client('s3') response = s3_client.list_buckets() for bucket in response['Buckets']: print(f'{bucket["Name"]}') except ClientError as e: print(e) list_buckets() EOF |
Step 3: Execute the script to priny all S3 bucket names in your AWS account
1 2 |
## list all s3 buckets using python boto3 python3 list_buckets.py |