If you do not enable real-time access of Archive objects, you can access Archive objects only after you restore them. Real-time access of Archive objects is not supported for Cold Archive and Deep Cold Archive objects. You can access Cold Archive and Deep Cold Archive objects only after you restore them. In most cases, the restoration of an Archive object requires several minutes to complete, the restoration of a Cold Archive object requires several hours to complete, and the restoration of a Deep Cold Archive object requires 12 to 48 hours to complete. The preceding restoration time is only for reference. The restoration time may vary based on the actual scenario. This topic describes how to run the restore command to restore objects.
Usage notes
To restore a single object, you must have the
oss:RestoreObject
permission. To restore objects by directory, you must have theoss:RestoreObject
andoss:ListObjects
permissions. For more information, see Attach a custom policy to a RAM user.For more information about the restoration process and billing rules, see Restore objects.
Command syntax
ossutil restore oss://bucket/object [flags]
Parameter | Type | Description |
--days | int | The duration within which the object remains in the restored state. Unit: days. Valid values: 1 to 365. When you perform operations on multiple objects in different storage classes at a time, if the value of the --days parameter exceeds the maximum duration for a specific storage class, the value is automatically set to the maximum duration for the storage class. For example, the maximum duration supported by Archive is 7 days, and the maximum duration supported by Deep Cold Archive is 365 days. If you set the --days parameter to 100, the duration for Archive objects is automatically set to 7 days and the duration for Deep Cold Archive objects is automatically set to 100 days. |
--dirs | / | Lists objects and subdirectories in the current directory, instead of recursively displaying all objects in all subdirectories. |
--encoding-type | string | The encoding method used to encode the object name. Valid value: url. |
--end-with | string | Specifies that objects whose names are alphabetically before or the same as the value of the --end-with parameter are returned. |
--exclude | stringArray | Specifies an exclusion rule for paths or object names. |
--exclude-from | stringArray | Reads exclusion rules from a file. |
--files-from | stringArray | Reads object names from a file, with empty lines or comment lines ignored. |
--files-from-raw | stringArray | Reads object names from a file, without ignoring empty lines and comment lines. |
--filter | stringArray | Specifies a filter rule for paths or object names. |
--filter-from | stringArray | Reads filter rules from a file. |
-f, --force | / | Forces the operation without requiring confirmation. |
--include | stringArray | Specifies an inclusion rule 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 calling the ListObjects operation. |
--max-age | Duration | Excludes objects whose last modified time is earlier than the value of this parameter. The default unit is s (seconds). You can suffix the numerical value with a unit: ms for milliseconds, s for seconds, m for minutes, h for hours, d for days, w for weeks, M for months, or y for years. |
--max-mtime | Time | Excludes objects whose last modified time is later than the value of this parameter. The time must be in UTC. |
--max-size | SizeSuffix | The maximum size of an object that can be transferred. By default, the size is in bytes (B). You can suffix the numerical value with a 1024-based unit: B for byte, K for Kibibyte, M for Mebibyte, G for Gibibyte, T for Tebibyte, or P for Pebibyte. |
--metadata-exclude | stringArray | Specifies an exclusion rule for object metadata. |
--metadata-filter | stringArray | The filter rule for object metadata. |
--metadata-filter-from | stringArray | Reads metadata filter rules from a file. |
--metadata-include | stringArray | Specifies an inclusion rule for object metadata. |
--min-age | Duration | Excludes objects whose last modified time is later than the value of this parameter. The default unit is s (seconds). You can suffix the numerical value with a unit: ms for milliseconds, s for seconds, m for minutes, h for hours, d for days, w for weeks, M for months, or y for years. |
--min-mtime | Time | Excludes objects whose last modified time is earlier than the value of this parameter. The time must be in UTC. |
--min-size | SizeSuffix | The minimum size of a file and object that can be transferred. By default, the size is in bytes (B). You can suffix the numerical value with a 1024-based unit: B for byte, K for Kibibyte, M for Mebibyte, G for Gibibyte, T for Tebibyte, or P for Pebibyte. |
--page-size | int | The maximum number of objects to return per page. Valid values: 1 to 1000. Default value: 1000. |
-r, --recursive | / | Specifies that the command performs the operation recursively. If this parameter is specified, the command performs the operation on all matching objects in the bucket. If this parameter is not specified, the command performs the operation only on the specified objects in the specified path. |
--request-payer | string | The payer of the request. If pay-by-requester is enabled, specify this parameter. Valid value: requester. |
--start-after | string | Specifies that objects whose names are alphabetically before or the same as the value of the --end-with parameter are returned. |
--tier | string | The restoration priority. Valid values:
|
--version-id | string | The version ID of the object. |
For more information, see Command-line options.
Examples
Restore an Archive object named exampleobject.txt in the examplebucket bucket:
ossutil restore oss://examplebucket/exampleobject.txt
Restore an Archive object named exampleobject.txt in the examplebucket bucket and set the duration within which the object remains in the restored state to 3:
ossutil restore oss://examplebucket/exampleobject.txt --days 3