s3cmd

Necessary s3cmd S3 permissions for PUT/Sync

百般思念 提交于 2019-12-03 08:52:00
问题 In moving to AWS EC2, I want to restrict my instances' user permissions for good reason. One thing the instances need to do is access files on S3 and write files there. However, I cannot find any way to achieve this without giving all permissions to that user . s3cmd allows me to call "ls" and "du" on the s3 buckets I gave the policy permission to, but always fails with a 403 error when trying to PUT/sync with one of these folders. If I use my root credentials, the transfer goes right through

How do I delete a versioned bucket in AWS S3 using the CLI?

天涯浪子 提交于 2019-12-03 02:36:46
问题 I have tried both s3cmd : $ s3cmd -r -f -v del s3://my-versioned-bucket/ And the AWS CLI: $ aws s3 rm s3://my-versioned-bucket/ --recursive But both of these commands simply add DELETE markers to S3. The command for removing a bucket also doesn't work (from the AWS CLI): $ aws s3 rb s3://my-versioned-bucket/ --force Cleaning up. Please wait... Completed 1 part(s) with ... file(s) remaining remove_bucket failed: s3://my-versioned-bucket/ A client error (BucketNotEmpty) occurred when calling

Necessary s3cmd S3 permissions for PUT/Sync

半城伤御伤魂 提交于 2019-12-02 22:47:21
In moving to AWS EC2, I want to restrict my instances' user permissions for good reason. One thing the instances need to do is access files on S3 and write files there. However, I cannot find any way to achieve this without giving all permissions to that user . s3cmd allows me to call "ls" and "du" on the s3 buckets I gave the policy permission to, but always fails with a 403 error when trying to PUT/sync with one of these folders. If I use my root credentials, the transfer goes right through. So, I don't get why if I give all permissions to the user for said buckets, it cannot PUT, but if I

How do I delete a versioned bucket in AWS S3 using the CLI?

淺唱寂寞╮ 提交于 2019-12-02 16:36:19
I have tried both s3cmd : $ s3cmd -r -f -v del s3://my-versioned-bucket/ And the AWS CLI: $ aws s3 rm s3://my-versioned-bucket/ --recursive But both of these commands simply add DELETE markers to S3. The command for removing a bucket also doesn't work (from the AWS CLI): $ aws s3 rb s3://my-versioned-bucket/ --force Cleaning up. Please wait... Completed 1 part(s) with ... file(s) remaining remove_bucket failed: s3://my-versioned-bucket/ A client error (BucketNotEmpty) occurred when calling the DeleteBucket operation: The bucket you tried to delete is not empty. You must delete all versions in

Why does file uploaded to S3 have content type application/octet-stream unless i name the file .html

微笑、不失礼 提交于 2019-12-01 15:46:05
Even though I set content type to text/html it ends up as application/octet-stream on S3. ByteArrayInputStream contentsAsStream = new ByteArrayInputStream(contentAsBytes); ObjectMetadata md = new ObjectMetadata(); md.setContentLength(contentAsBytes.length); md.setContentType("text/html"); s3.putObject(new PutObjectRequest(ARTIST_BUCKET_NAME, artistId, contentsAsStream, md)); If however I name the file so that it ends up with .html s3.putObject(new PutObjectRequest(ARTIST_BUCKET_NAME, artistId + ".html", contentsAsStream, md)); then it works. Is my md object just being ignored ? How can I get

Why does file uploaded to S3 have content type application/octet-stream unless i name the file .html

时光总嘲笑我的痴心妄想 提交于 2019-12-01 13:51:12
问题 Even though I set content type to text/html it ends up as application/octet-stream on S3. ByteArrayInputStream contentsAsStream = new ByteArrayInputStream(contentAsBytes); ObjectMetadata md = new ObjectMetadata(); md.setContentLength(contentAsBytes.length); md.setContentType("text/html"); s3.putObject(new PutObjectRequest(ARTIST_BUCKET_NAME, artistId, contentsAsStream, md)); If however I name the file so that it ends up with .html s3.putObject(new PutObjectRequest(ARTIST_BUCKET_NAME, artistId

How to delete or purge old files on S3?

限于喜欢 提交于 2019-11-30 11:43:04
问题 Are there existing solutions to delete any files older than x days? 回答1: Amazon has introduced object expiration recently. Amazon S3 Announces Object Expiration Amazon S3 announced a new feature, Object Expiration that allows you to schedule the deletion of your objects after a pre-defined time period. Using Object Expiration to schedule periodic removal of objects eliminates the need for you to identify objects for deletion and submit delete requests to Amazon S3. You can define Object

Difference between s3cmd, boto and AWS CLI

无人久伴 提交于 2019-11-30 10:45:35
I am thinking about redeploying my static website to Amazon S3. I need to automate the deployment so I was looking for an API for such tasks. I'm a bit confused over the different options. Question : What is the difference between s3cmd, the Python library boto and AWS CLI? mfisherca s3cmd and AWS CLI are both command line tools. They're well suited if you want to script your deployment through shell scripting (e.g. bash). AWS CLI gives you simple file-copying abilities through the "s3" command, which should be enough to deploy a static website to an S3 bucket. It also has some small

Zip an entire directory on S3

不羁的心 提交于 2019-11-30 09:45:13
If I have a directory with ~5000 small files on S3, is there a way to easily zip up the entire directory and leave the resulting zip file on S3? I need to do this without having to manually access each file myself. Thanks! No, there is no magic bullet. (As an aside, you have to realize that there is no such thing as a "directory" in S3. There are only objects with paths. You can get directory-like listings, but the '/' character isn't magic - you can get prefixes by any character you want.) As someone pointed out, "pre-zipping" them can help both download speed and append speed. (At the

Creating a folder via s3cmd (Amazon S3)

三世轮回 提交于 2019-11-30 06:34:59
I am using s3cmd to upload files to my S3 server. My problem is that when a directory on the server does not exist the upload fails. How can I tell s3cmd to create the folder if it does not exist? I am using PHP. I believe you should try something like s3cmd put file.jpg s3://bucket/folder/file.jpg . S3 doesn't have the concept of directories, the whole folder/file.jpg is the file name. If using a GUI tool or something you delete the file.jpg from inside the folder, you will most probably see that the folder is gone too. The visual representation in terms of directories is for user convenience