restore (restore objects)

Top  Previous  Next

restore [BUCKET_NAME]/[FOLDER]/OBJECT -days:X [-tier:X] [-s] [-r] [-sim] [-stoponerror] [-noconfirm:X] [-cond:"FILTER"] [-include:INCL] [-exclude:EXCL] [-rinclude:INCL] [-rexclude:EXCL] [-inclenc] [-exclenc] [-inclle] [-exclle] [-inclgl] [-exclgl] [-version:ID] [-inclversions] [-onlyprev]

Restore copies of archived objects. Specify the number of days you want the object copy restored for.

 

Parameter

Description

Examples

[BUCKET_NAME]/[FOLDER]/OBJECT

Name of the bucket, folder, object(s) to restore.

If not specified, objects in current location are restored.

Wildcard character can be used (i.e. * and ?) like in Windows dir. If object name have spaces, they must be surrounded by  quotation marks (") on the command line.

restore mybucket/*.txt  -days:1 (restore all objects with extension txt in mybucket for 1 day)

restore mybucket/myfolder/*.txt  -days:2 (restore all objects with extension txt in mybucket/myfolder/ for 2 days)

restore "mybucket/my folder/*.txt" -days:2 (restore all objects with extension txt in mybucket/my folder/ for 2 days, using quotation marks)

-days:X

Required. The number of days you want the object copy restored.

restore mybucket/myfile.txt -days:10 (restore myfile.txt in mybucket for 10 days)

-tier:X

Optional. When restoring archived objects, you can specify one of the following data access tier options with the -Tier parameter: Expedited | Standard | Bulk.
The default value, if not specified, is Standard.
See the Amazon S3 documentation for more information.

restore mybucket/a.txt -days:5 -tier:Expedited

restore *.jpg -s -days:10 -tier:Bulk

-s

Recursive restore, e.g. process objects in all subfolders.

restore mybucket/* -s -days:1  (restore all objects in mybucket and subfolders for 1 day)

-r

Regular expression. This flag specifies that [BUCKET_NAME]/[FOLDER]/OBJECT is to be treated as a regular expression.

restore "mybucket/my folder/.*\.txt|.*\.vsn" -r -days:2 (restore all objects with extension txt or vsn in mybucket/my folder/ for 2 days)

restore mybucket/^r.* -r  -days:2 (restore all objects starting with 'r' in mybucket for 2 days)

-sim

Only preview which objects would be restored, do not actually restore the objects.

restore mybucket/* -sim -days:10 (preview object restore of all files in mybucket)

-stoponerror

Stop restoring files as soon as an error occurs (do not continue with other files).

restore mybucket/*.txt -stoponerror -days:1 (restore all objects with extension txt in mybucket for 1 day, stop if and as soon as an error occurs, e.g. do not continue with other files)

-noconfirm:X

Use -noconfirm to disable the restore confirmation request "Confirm restore of ..." that appears if more than 1 object is selected to be restored.
You can use also -noconfirm with a value, e.g. -noconfirm:10. This would disable the confirmation request only for up to 10 files: if more than 10 files are selected to be restored the confirmation question is still shown.

restore mybucket -s -noconfirm -days:7 (restore all files in mybucket and subfolders for 7 days and do not ask for confirmation)
restore mybucket -s -noconfirm:100 -days:3 (restore all files in mybucket and subfolders for 3 days and do not ask for confirmation if 100 or less files are selected to be restored. Ask for confirmation if more than 100 files are selected to be restored.)

-cond:
"FILTER"

Filter condition. Only restore objects matching the specified condition. More info on filter condition syntax and variables.

restore mybucket -s -cond:"extract_value(cache-control,'max-age') > 0" -days:1 (restore all objects in mybucket (recursive, include subfolders) for 1 day if cache-control:max-age > 0 in the metadata)

restore mybucket -s -cond:"size = 0" - days:2 (restore all objects in mybucket (recursive) if size equal to zero)

restore mybucket -cond:"name starts_with 'a'" - days:7 (restore all objects in mybucket (non-recursive) if name starting with a)

restore mybucket -s -cond:"name starts_with 'a' and size > 0" - days:10 (restore all objects in mybucket (recursive) with name starting with a and size > 0)

More info on filter condition syntax and variables

-include:INCL

Only include objects matching specified mask (Wildcards). Separate multiple masks with "|".

restore mybucket -include:*.jpg -days:10 (restore all jpg files in mybucket for 10 days)

restore mybucket -include:*.jpg|*.gif -days:1 (restore all jpg and gif files in mybucket for 1 day)

-exclude:EXCL

Exclude objects matching specified mask (Wildcards). Separate multiple masks with "|".

restore mybucket -exclude:*.jpg -days:1 (restore all files in mybucket but exclude jpg files)

restore mybucket -exclude:*.jpg|*.gif -days:1 (restore all files in mybucket but exclude jpg files)

-rinclude:INCL

Only include objects matching specified mask (Regular Expression).

restore mybucket -rinclude:a(x|y|z)b -days:1 (restore files in mybucket matching axb, ayb and azb)

restore mybucket -rinclude:*.(gif|bmp|jpg) -days:1 (restore files in mybucket matching anything ending with .gif, .bmp or .jpg)

restore mybucket -rinclude:"IMGP[0-9]{4}.jpg" -days:1 (restore files in mybucket ending with .jpg , starting with IMG and followed by a four-digit number)

-rexclude:EXCL

Exclude objects matching specified mask (Regular Expression).

restore mybucket -rexclude:[abc] -days:1 (restore all files in mybucket but exclude files containing a, b or c)

-inclenc
-exclenc

Include only server-side encrypted files.
Exclude server-side encrypted files.

restore mybucket -inclenc -days:1 (restore all files in mybucket that are server-side encrypted)

restore mybucket -exclenc -days:1 (restore all files in mybucket that are NOT server-side encrypted)

-inclgl
-exclgl

Include only Glacier files.

Exclude Glacier files.

restore mybucket -inclgl -days:1 (restore all files in mybucket that are part of Amazon Glacier)

-inclle
-exclle

Include only client-side (locally) encrypted files.

Exclude only client-side (locally) encrypted files.

restore mybucket -inclle -days:1 (restore all files in mybucket that were locally encrypted)

restore mybucket -exclle -days:1 (restore all files in mybucket that were NOT locally encrypted)

-version:ID

Specify version ID of object to be restored (for buckets with object versioning enabled).

restore mybucket/file.txt -version:23443232 -days:2 (restore object file.txt, object version ID 23443232, in mybucket, for 2 days)

-inclversions

Include object previous versions (for buckets with object versioning enabled).

restore mybucket/*.txt -inclversions -days:9 (restore all objects with extension txt in mybucket and also all previous versions of the objects for 9 days)

-onlyprev

Include only the previous versions of an object. All current versions of objects are excluded (for buckets with object versioning enabled).

restore mybucket/*.txt -onlyprev -days:5 -cond:"s3_age_months<=6" (restore all and only previous versions of objects with extension txt in mybucket, which are dated less than 6 months ago, for 5 days)

 

Notes:
- Use  quotation marks (") if folder or object names contain blank spaces, e.g. restore "mybucket/my folder/name with a space.txt"
- If multiple files are to be restored, the operation will be performed using multiple concurrent threads. The maximum threads to use can be specified with the command setopt , option -qmaxthreads