If direct read is not enabled, Archive objects must be restored before they can be read. The Cold Archive and Deep Cold Archive storage classes do not support direct read. Therefore, objects in these classes must be restored before they can be read. Restoring an Archive object typically takes several minutes. Restoring a Cold Archive object typically takes several hours. Restoring a Deep Cold Archive object typically takes 12 to 48 hours. The actual restoration time may vary. This topic describes how to restore files by using the restore command.
Considerations
-
To restore a single file, you must have the
oss:RestoreObjectpermission. To restore files by directory, you must have theoss:RestoreObjectandoss:ListObjectspermissions. For more information, see Grant custom policies to a RAM user. -
For details on the restoration status and fees for objects in Archive Storage, Cold Archive Storage, or Deep Cold Archive Storage, see Restore objects.
Command syntax
ossutil restore oss://bucket/object [flags]
|
Parameter |
Type |
Description |
|
--days |
int |
The number of days the restored object remains accessible. Valid values: 1 to 365. When you run a batch operation on objects from different storage classes, if the specified number of days exceeds the maximum allowed for a storage class, the value is automatically adjusted to that class's maximum. For example, the maximum duration for Archive Storage is 7 days, and for Deep Cold Archive Storage is 365 days. If you set |
|
--tier |
string |
The restoration priority. This parameter is not required for Archive Storage objects, as they restore in about one minute.
When you batch-restore objects from different storage classes, if a specified tier is not supported by a class, it is automatically adjusted to the lowest supported priority for that class. For example, Cold Archive Storage supports the Bulk tier, but Deep Cold Archive Storage supports only the Standard tier. If you set |
|
--dirs |
/ |
Lists objects and subdirectories in the specified directory, but not recursively. |
|
--encoding-type |
string |
The encoding type of the object or file names to be processed. Valid value: url. |
|
--end-with |
string |
Lists objects that are alphabetically at or before the specified value. |
|
--exclude |
stringArray |
Exclusion rules for paths or object names. |
|
--exclude-from |
stringArray |
Reads exclusion rules from a file. |
|
--files-from |
stringArray |
Reads a list of source file names from a file. Blank lines and comment lines are ignored. |
|
--files-from-raw |
stringArray |
Reads a list of source file names from a file. |
|
--filter |
stringArray |
Filter rules for paths or object names. |
|
--filter-from |
stringArray |
Reads filter rules from a file. |
|
-f, --force |
/ |
Forces the operation without prompting for confirmation. |
|
--include |
stringArray |
Inclusion rules for paths or object names. |
|
--include-from |
stringArray |
Reads inclusion rules from a file. |
|
--limited-num |
int |
The maximum number of results to return. |
|
--list-objects |
/ |
Lists objects by using the ListObjects operation. |
|
--min-age |
Duration |
Excludes objects that are newer than the specified value. The default unit is seconds. You can also use a unit suffix, such as Note
|
|
--max-age |
Duration |
Excludes objects that are older than the specified value. The default unit is seconds. You can also use a unit suffix, such as |
|
--min-mtime |
Time |
Excludes objects modified before the specified time. The time must be in UTC format. Example: 2006-01-02T15:04:05. Note
|
|
--max-mtime |
Time |
Excludes objects modified after the specified time. The time must be in UTC format. Example: 2006-01-02T15:04:05. |
|
--max-size |
SizeSuffix |
The maximum size of an object to restore. The default unit is bytes. You can use suffixes such as B, K, M, G, T, or P. 1 K (KiB) equals 1,024 bytes. |
|
--metadata-exclude |
stringArray |
Exclusion rules for object metadata. |
|
--metadata-filter |
stringArray |
Filter rules for object metadata. |
|
--metadata-filter-from |
stringArray |
Reads filter rules for object metadata from a file. |
|
--metadata-include |
stringArray |
Inclusion rules for object metadata. |
|
--min-size |
SizeSuffix |
The minimum size of an object to restore. The default unit is bytes. You can use suffixes such as B, K, M, G, T, or P. 1 K (KiB) equals 1,024 bytes. |
|
--page-size |
int |
The maximum number of objects to list per page in batch operations. Default value: 1000. Valid values: 1 to 1000. |
|
-r, --recursive |
/ |
Recursively performs the operation on all matching objects under the specified prefix. Without this option, the command applies only to the specified object. |
|
--request-payer |
string |
Specifies the payer for the request. Set this to |
|
--start-after |
string |
Lists objects that are alphabetically after the specified value, excluding the value itself. |
|
--version-id |
string |
The version ID of the object. |
|
--list-format |
string |
The format of the list file. Valid values: plain and inventory. |
|
--list-manifest-from |
string |
Reads the description of the list file format from a manifest file. This parameter is required when |
For more information, see Command-line options.
Examples
Archive Storage
-
The following command restores the object
exampleobject.txtfrom the bucketexamplebucket.ossutil restore oss://examplebucket/exampleobject.txt -
The following command restores the object
exampleobject.txtfrom the bucketexamplebucketand sets the restoration duration to 3 days.ossutil restore oss://examplebucket/exampleobject.txt --days 3 -
Restore objects from a list file.
NoteEach line in the list file specifies one object and uses the OSS path format
oss://{bucket}/{key}. For example, thelist.txtfile contains:oss://examplebucket/key1 oss://examplebucket/key2ossutil restore list://list.txt -
Restore objects from a list file without checking the status of the objects.
ossutil restore list://list.txt --no-check-status -
Restore objects from an inventory file.
NoteAfter an inventory job is complete, a
csv.gzfile and amanifest.jsonfile are generated. Both files are required to restore objects from an inventory file.ossutil restore list://ca8007fc-4123-493e-9a01-dd1511fbac54.csv.gz --list-format inventory --list-manifest-from manifest.json -
Restore objects from an inventory file without checking the status of the objects.
ossutil restore list://ca8007fc-4123-493e-9a01-dd1511fbac54.csv.gz --list-format inventory --list-manifest-from manifest.json --no-check-status
Cold Archive Storage
The following command restores the Cold Archive Storage object exampleobject.txt from the bucket examplebucket and sets the restoration duration to 5 days.
ossutil restore oss://examplebucket/exampleobject.txt --tier Bulk --days 5
The following command recursively restores all .csv objects in Cold Archive Storage from the dir/ prefix in the examplebucket bucket. The restoration duration is set to 5 days.
ossutil restore oss://examplebucket/dir/ -r --include "*.csv" --tier Bulk --days 5
Deep Cold Archive Storage
The following command restores the Deep Cold Archive Storage object exampleobject.txt from the bucket examplebucket and sets the restoration duration to 10 days.
ossutil restore oss://examplebucket/exampleobject.txt --tier Standard --days 10
The following command recursively restores all .csv objects in Deep Cold Archive Storage from the dir/ prefix in the examplebucket bucket. The restoration duration is set to 10 days.
ossutil restore oss://examplebucket/dir/ -r --include "*.csv" --tier Standard --days 10
Billing
-
Data retrieval fees are incurred when you restore Archive, Cold Archive, and Deep Cold Archive objects. For more information, see Data processing fees.
-
Archive objects can remain in the restored state for up to 7 days. Cold Archive and Deep Cold Archive objects can remain in the restored state for up to 365 days. No additional data retrieval fees are incurred during this period.
-
After the restored state ends, the object returns to the frozen state. If you restore the object again, data retrieval fees are incurred.
-
When you restore a Cold Archive or Deep Cold Archive object, a replica of the object is created in the Standard storage class to allow access. While the object is in the restored state, you are charged for the temporary storage of this replica at the rate of the Standard storage class. For more information, see Temporary storage fees.