2 Respostas
- Mais recentes
- Mais votos
- Mais comentários
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?
respondido há um ano
Conteúdo relevante
- AWS OFICIALAtualizada há 4 anos
- AWS OFICIALAtualizada há 10 meses
- AWS OFICIALAtualizada há 8 meses
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.