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, and 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. |
--tier | string | The restoration priority. You do not need to specify this parameter for Archive objects. The restoration requires approximately 1 minute.
When you perform operations on multiple objects in different storage classes at a time, if the value of the --tier parameter exceeds the priority value supported by the storage class, the value is automatically set to the lowest priority for the storage class. For example, Cold Archive objects support Bulk, while Deep Cold Archive objects only support Standard. In this case, the restoration priority is automatically adjusted to Standard if you set the --tier parameter to Bulk. |
--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. |
--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 | Read the format description of the list file from the file. You are required to specify this parameter if the format is inventory. |
For more information, see Command-line options.
Examples
Restore Archive objects
The following sample code provides an example on how to restore an Archive object named exampleobject.txt in examplebucket:
ossutil restore oss://examplebucket/exampleobject.txt
The following sample code provides an example on how to restore an Archive object named exampleobject.txt in examplebucket and set the duration within which the object remains in the restored state to 3:
ossutil restore oss://examplebucket/exampleobject.txt --days 3
The following sample code provides an example on how to restore objects from the list.
NoteEach line in the list file represents an object. All objects within are in the format of the OSS path: oss://{bucket}/{key}.
The following section uses list.txt as an example.
oss://examplebucket/key1 oss://examplebucket/key2
ossutil restore list://list.txt
The following sample code provides an example on how to restore objects directly from the list. The status of objects is not checked.
ossutil restore list://list.txt --no-check-status
The following sample code provides an example on how to restore objects from the list file.
NoteA csv.gz file and a manifest.json file are generated after the inventory is configured, which are required for the restoration of objects from the list file.
ossutil restore list://ca8007fc-4123-493e-9a01-dd1511fbac54.csv.gz --list-format inventory --list-manifest-from manifest.json
The following sample code provides an example on how to restore objects directly from the list file. The status of objects is not checked.
ossutil restore list://ca8007fc-4123-493e-9a01-dd1511fbac54.csv.gz --list-format inventory --list-manifest-from manifest.json --no-check-status
Restore Cold Archive objects
The following sample code provides an example on how to restore a Cold Archive object named exampleobject.txt in examplebucket and set the duration within which the object remains in the restored state to 5:
ossutil restore oss://examplebucket/exampleobject.txt --tier Bulk --days 5
Restore Deep Cold Archive objects
The following sample code provides an example on how to restore a Deep Cold Archive object named exampleobject.txt in examplebucket and set the duration within which the object remains in the restored state to 10:
ossutil restore oss://examplebucket/exampleobject.txt --tier Standard --days 10
Billing rules
You are charged data retrieval fees based on the size of the restored Archive, Cold Archive, or Deep Cold archive objects. For more information, see Data processing fees.
You are charged API operation calling fees based on the number of PUT requests when you restore Archive objects. For more information, see API operation calling fees.
You are charged data retrieval requests when you restore Cold Archive or Deep Cold Archive objects. For more information, see API operation calling fees.
You are charged storage fees based on billing rules for Archive, Cold Archive, and Deep Cold Archive objects during and after the restoration. For more information, see Storage fees.
When you restore a Cold Archive or Deep Cold Archive object, a Standard replica of the object is generated for temporary access. You are charged for the temporary storage of the replica based on the Standard storage class until the Cold Archive or Deep Cold Archive object returns to the frozen state. For more information, see Temporary storage fees.
An Archive object can remain in the restored state for up to seven days. A Cold Archive or Deep Cold Archive object can remain in the restored state for up to 365 days. You are not charged data retrieval fees when an object is in the restored state.
After the period of time during which an object is in the restored state ends, the object returns to the frozen state. If you restore the object after it returns to the frozen state, you are charged data retrieval fees.