2 réponses
- Le plus récent
- Le plus de votes
- La plupart des commentaires
1
Hi,
You can try to use a combination of delete-objects CLI command with a list-object-versions
aws s3api delete-objects --bucket <bucketName> \
--delete "$(aws s3api list-object-versions \
--bucket "<bucketName>" \
--no-paginate \
--query='{Objects: Versions[].{Key:Key,VersionId:VersionId}}')"
Hope it helps ;)
0
While running suggested "aws s3api delete-objects ..." command.
I observed the matrics of the bucket, it shows the size increased by few more GB, and can see every (almost all) objects in the bucket are marked as delete marker.
Wants to understand how delete is working, is it like first it will marke object to delete marker and then in coming future those objects will get deleted?
Will it get deleted by lifecycle set on the bucket?
répondu il y a un an
Contenus pertinents
- demandé il y a 7 mois
- demandé il y a un an
- demandé il y a 4 mois
- demandé il y a un an
- AWS OFFICIELA mis à jour il y a un an
- AWS OFFICIELA mis à jour il y a 4 ans
- AWS OFFICIELA mis à jour il y a 2 ans
Thanks @alatech
Seems it is working, but it is listing array of 10 objects only, saying those 10 objects are deleted, so does it need to call in loop untill all objects get deleted?
Let me try.
Try tweaking the parameters related to pagination: https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-pagination.html
This is extremely slow though, and sadly not parallelisable, due to the terrible way AWS SDK/CLI handles pagination. Lifecycle rules are so far the best method I have found, but even that takes days just do to the delay with a minimum of 1 day of age for the two steps each, and more if there are a large number of objects. I've tried S3 Batch Operations, but not only is it very hard to operate, but it doesn't seem to support deleting actual objects or worse object versions, just tags of objects or copying objects.