I want to create an empty folder in amazon S3 using ruby ββsdk. Ive read that in S3 there is no concept of folders, so theoretically to create a folder you would just create an empty object with the ending "/"
s3 = Aws::S3::Client.new( region: 'eu-west-1', credentials: creds) s3.put_object(bucket: "my_bucket", key: "my_folder/")
Doing this creates an empty object in my bucket, but then if I try to upload the file as follows:
s3.put_object(bucket: "my_bucket", key: "my_folder/myfile")
It does not create a file in my folder. It maintains an old empty object and creates a folder and file. Therefore, after two commands, the structure of the bucket:
my_bucket/ my_folder my_folder/ my_file
Why is this happening? why does it create my_folder object twice? How to create an empty folder for future use?
source share