Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)
I am using the AWS SDK for python Boto3. And I want to create folders directly using it. Is there any template or sample code which I could use? Please reply to me.

1 Answer

0 votes
by (44.4k points)

Yes, there is. It is just 5 lines of code where one line is importing boto3.

import boto3

s3 = boto3.client('s3')

bucket_name = "bucket-name-here"

folder_name = "name/ofyour/folders"

s3.put_object(Bucket=bucket_name, Key=(folder_name+'/'))

In folder_name, provide all the folder names you want to add.

Hope this helps!

by (100 points)
thanks @kodee this is what I was looking for

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer

Browse Categories

...