List all the existing buckets for the AWS account using Boto3

0 votes

Hi Guys,

I have created S3 buckets in AWS. I want to list all the available buckets using the boto3 module. How can I do that?

Oct 8, 2020 in AWS by akhtar
• 38,260 points
1,683 views

1 answer to this question.

0 votes

Hi@akhtar,

You need to create a client using the boto3 module. It allows you to use some attributes related to s3 as shown below.

s3 = boto3.client('s3')
response = s3.list_buckets()

# Output the bucket names
print('Existing buckets:')
for bucket in response['Buckets']:
    print(f'  {bucket["Name"]}')
answered Oct 8, 2020 by MD
• 95,460 points

Related Questions In AWS

0 votes
1 answer

List all the existing queues - AWS SQS

Yes, that's possible, you can use the ...READ MORE

answered Aug 20, 2019 in AWS by Vishal
738 views
0 votes
1 answer

List All AWS EC2 Instances using boto3.

Hi@MD, You need to import the boto3 module ...READ MORE

answered Oct 7, 2020 in AWS by akhtar
• 38,260 points
30,844 views
0 votes
1 answer
0 votes
1 answer

Pass account id of an AWS sub account using a variable as an argument in CloudWatch Alarm Actions with python (boto3)?

Python String and Integer concatenation >>> print("arn:aws:swf:us-east-2:{0}:action/actions/AWS_EC2.InstanceId.Stop/1.0".format(acccnum)) arn:aws:swf:us-east-2:12312312312312:action/actions/AWS_EC2.InstanceId.Stop/1.0 >>> print("arn:aws:swf:us-east-2:" ...READ MORE

answered Oct 5, 2018 in AWS by Priyaj
• 58,020 points
1,599 views
0 votes
1 answer
+1 vote
2 answers
0 votes
1 answer

how to get the list of aws services i am used in aws my account by using the lambda function

Hi@shalk, You can create a session in your ...READ MORE

answered Sep 24, 2020 in AWS by MD
• 95,460 points
2,470 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP