简体   繁体   中英

Is it possible to have folders in AWS S3 bucket?

I am very very new to AWS S3.

I have the following questions,

Question 1) Is it possible to have folders and sub-folders in S3 buckets? For eg as below:在此处输入图片说明

Here **Root folder 'Folder' has 2 sub-folders and a file. Then Sub-folder1 has 2 sub-folders and a file. etc.

Question 2) If i have the above structure in S3, How can I retrieve the data by Java code usinf AWS SDK for Java?

In aws s3, every file is an object. If you want to upload a specific file in say folder1 your object key should be folder1/filename.ext, if in subfolder of folder1 then it should be folder1/subfolder/filename.ext. So your question 1 is possible even though it is practically not a directory.

When requesting for objects in the folder you can use delimiter and prefix to obtain objects in specific folder see http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGET.html and http://docs.aws.amazon.com/AmazonS3/latest/dev/ListingObjectKeysUsingJava.html

Yes, you can group S3 objects in a logical hierarchy .

Yes, you can retrieve objects using any support language, including Java. The web has plenty of examples of how to do this, and it's quite simple. The canonical example is Get an Object using the AWS SDK for Java .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM