s3undelete is a simple utility that removes delete markers from S3 (and S3-compatible) objects in buckets that have versioning enabled.
It's handy if you accidentally delete a lot of data.
usage: s3undelete list|undelete region endpoint[/path/to/directory]
With the 'list' argument, s3undelete prints a list of objects with delete markers as the latest version.
With the 'undelete' argument, s3undelete removes the delete marker from each object that has a delete marker as the latest version.
To use s3undelete
, set 2 environment variables, AWS_ACCESS_KEY
and AWS_SECRET_KEY
, to your S3 access key ID and secret access key respectively.
s3undelete list us-east-1 https://s3.us-east-1.amazonaws.com/myversionedbucket
s3undelete list us-east-1 https://s3.us-east-1.amazonaws.com/myversionedbucket/myobjects/subdirectory
Removing delete markers:
s3undelete undelete us-east-1 https://s3.us-east-1.amazonaws.com/myversionedbucket/myobjects/subdirectory
s3undelete undelete us-west-1 https://s3.us-west-001.backblazeb2.com/arq-versioned