Reading Time: < 1 minute
This tutorial will guide you on How To get AWS S3 Bucket lists Using Python Boto3. We consider you already have an AWS account however if you do not have please follow the below tutorial to create an AWS account. Once you have an AWS account, You may proceed to create an AWS S3 bucket using Python. You should also create/grant AWS CLI access. Python boto3 is a powerful python module that can be used programmatically to create and view AWS resources.
If you have not created S3 Bucket yet, You should create S3 bucket first and this tutorial “How To Create AWS S3 Bucket Using Python Boto3“
Table of Contents
How To get AWS S3 Bucket lists Using Python Boto3
import boto3
import logging
s3 = boto3.client('s3')
response = s3.list_buckets()
# Output the bucket names
print('Existing buckets:')
for bucket in response['Buckets']:
print(f' {bucket["Name"]}')
response
for bucket in response['Buckets']:
print(f' "Bucket Name : " {bucket["Name"]}')
print(f' "Create Date : " {bucket["CreationDate"]}')
You can also learn “How to create EC2 instance“
You can also learn “How to describe EC2 instance using Python boto3“
S3 Official website