Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws s3 sync --delete: delete files _after_ uploading #1417

Open
tusbar opened this issue Jul 9, 2015 · 11 comments
Open

aws s3 sync --delete: delete files _after_ uploading #1417

tusbar opened this issue Jul 9, 2015 · 11 comments
Labels
feature-request A feature should be added or improved. p3 This is a minor priority issue s3sync s3syncstrategy s3

Comments

@tusbar
Copy link

tusbar commented Jul 9, 2015

Hello,

With awscli==1.7.37, when using s3 sync --delete, is there a way to have the files be deleted after the rest is uploaded? It seems like they’re always deleted before uploading.

$ aws s3 sync --delete dist s3://bucket
delete: s3://bucket/scripts/bundle.65406bc3e1133110.js
upload: dist/index.html to s3://bucket/index.html
upload: dist/scripts/bundle.9ad9b21077147aa5.js to s3://bucket/scripts/bundle.9ad9b21077147aa5.js
upload: dist/styles/bundle.6de17660ab595a44.css to s3://bucket/styles/bundle.6de17660ab595a44.css
@mtdowling
Copy link
Member

What's the reasoning for waiting to delete until after all uploads are complete? If we did that, then we'd have to keep every delete request in memory, which could consume a large amount of memory for large buckets.

@tusbar
Copy link
Author

tusbar commented Jul 9, 2015

@mtdowling all the reasoning that’s behind rsync’s --delete-after.

For example, if the transfer fails while syncing, let’s say right after the delete, I’ve deleted the old files, but haven’t added any of the new, which could be a problem.

@mtdowling mtdowling added feature-request A feature should be added or improved. and removed response-needed labels Jul 9, 2015
@mtdowling
Copy link
Member

Interesting. I suppose we could also evaluate adding other delete strategies similar to the delete options offered by rsync. I'll mark this as a feature request, and we'll add it to our backlog.

@tusbar
Copy link
Author

tusbar commented Jul 15, 2015

A quick workaround is to run the sync command twice, once without --delete, then with the --delete flag.

@ASayre
Copy link
Contributor

ASayre commented Feb 6, 2018

Good Morning!

We're closing this issue here on GitHub, as part of our migration to UserVoice for feature requests involving the AWS CLI.

This will let us get the most important features to you, by making it easier to search for and show support for the features you care the most about, without diluting the conversation with bug reports.

As a quick UserVoice primer (if not already familiar): after an idea is posted, people can vote on the ideas, and the product team will be responding directly to the most popular suggestions.

We’ve imported existing feature requests from GitHub - Search for this issue there!

And don't worry, this issue will still exist on GitHub for posterity's sake. As it’s a text-only import of the original post into UserVoice, we’ll still be keeping in mind the comments and discussion that already exist here on the GitHub issue.

GitHub will remain the channel for reporting bugs.

Once again, this issue can now be found by searching for the title on: https://aws.uservoice.com/forums/598381-aws-command-line-interface

-The AWS SDKs & Tools Team

@ASayre ASayre closed this as completed Feb 6, 2018
@jamesls
Copy link
Member

jamesls commented Apr 6, 2018

Based on community feedback, we have decided to return feature requests to GitHub issues.

@jamesls jamesls reopened this Apr 6, 2018
@mehditlili
Copy link

Any updates on this? the feature delete_after is important IMHO in order to clean up source systems that have been synced

@tusbar
Copy link
Author

tusbar commented Aug 16, 2018

@mehditlili use rclone instead.

@balloob
Copy link

balloob commented Jul 26, 2019

Run your command twice, second time with --delete will delete the files after and won't re-upload the files the second time you run it.

@lcswillems
Copy link

Run your command twice, second time with --delete will delete the files after and won't re-upload the files the second time you run it.

That's a nice workaround! However it is slower than if the command was run once with the deletes at the end.

@unfor19
Copy link

unfor19 commented Sep 13, 2022

@mehditlili use rclone instead.

Thank you for sharing this holy grail! This is exactly what I needed - rclone delete-after.

For deploying a static website to S3, I can safely say that storing the website's content in memory due to delete-after, which usually takes up to 30MB (depending on the website), is ok.

Thanks again!

@tim-finnigan tim-finnigan added p3 This is a minor priority issue s3sync labels Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. p3 This is a minor priority issue s3sync s3syncstrategy s3
Projects
None yet
Development

No branches or pull requests

10 participants