Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create folder on S3 from Ec2 instance

I want to create folder in S3 bucket from Ec2 instacne . I tried the put object but its not working . Is there any way of creating folder on s3 from ec2 instace using cli.

like image 746
Shrikant Avatar asked Apr 25 '16 10:04

Shrikant


People also ask

How do I create a folder on AWS S3?

Creating a folder Instead, upload an empty folder and specify these settings in the upload configuration. Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/ . In the Buckets list, choose the name of the bucket that you want to create a folder in.

Can we copy folder from EC2 to S3?

After generating the Access key ID and secret access key, log into the EC2 instance using SSH and configure the access key. It will ask for an access key ID and the secret access key. Provide the credentials we just generated. Now the EC2 instance has access to upload the files on S3 using the command line interface.

Does S3 create folder automatically?

S3 doesn't have a folder structure, But there is something called as keys. We can create /2013/11/xyz. xls and will be shown as folder's in the console. But the storage part of S3 will take that as the file name.

Can S3 have folders?

In Amazon S3, folders are used to group objects and organize files. Unlike a traditional file system, Amazon S3 doesn't use hierarchy to organize its objects and files. For the sake of organizational simplicity, Amazon S3 console supports the folder concept as a means of grouping objects.


1 Answers

You don't need to create a folder to put item in it. For example, just run something like the below command and s3 will create the folders if they don't exist:

aws s3 cp ./testfile s3://yourBucketName/any/path/you/like

If you want to use cp recursively you can specify --recursive option, or use "aws s3 sync".

If your command does not work, then you may have permission issues. Paste your error so that we can help you.

like image 187
Tom Avatar answered Oct 12 '22 01:10

Tom