Managing Storage Objects
In the Object Storage service, an object is a file or unstructured data you upload to a bucket within a compartment within an Object Storage namespace.
The object can be any type of data, for example, multimedia files, data backups, static web content, or logs. You can store objects that are up to 10 TiB. Objects are processed as a single entity. You can't edit or append data to an object, but you can replace the entire object.
Object Storage is not tied to any specific compute instance. You can access data from anywhere inside or outside of the Oracle Private Cloud Appliance, as long you have internet connectivity, access to the Object Storage endpoint, and authorization.
For more conceptual information, refer to the Object Storage Overview section in the Oracle Private Cloud Appliance Concepts Guide.
Viewing Objects in a Bucket
Using the Compute Web UI
-
In the navigation menu, under Object Storage, click Object Storage.
-
Choose the compartment that contains the bucket that contains your object.
A list of buckets is displayed.
-
Click the bucket name that contains your object.
-
Click Objects under Resources.
Using the OCI CLI
-
Listing Objects in a bucket
-
Gather the information you need to run the command.
-
Namespace (see Obtaining the Object Storage Namespace)
-
Bucket name (
oci os bucket list
), see Listing Buckets
-
-
Enter this command.
Syntax (entered on a single line):
oci os object list --namespace-name <object_storage_namespace> --bucket-name <bucket_name>
Example:
oci os object list \ --namespace-name examplenamespace \ --bucket-name MyBucket { "data": [ { "etag": null, "md5": "Ucf+fZbCK/RN5gGsEl7G5w==", "name": "eventslogreference.htm", "size": 1363, "time-created": "2021-06-01T17:57:16+00:00", "time-modified": null } ], "prefixes": [] }
-
-
Listing object details
-
Gather the information you need to run the command.
-
Namespace (see Obtaining the Object Storage Namespace)
-
Bucket name (
oci os bucket list
), see Listing Buckets -
Object name (
oci os object list)
, see previous example
-
-
Run this command.
Syntax (entered on a single line):
oci os object head --namespace-name <object_storage_namespace> --bucket-name <bucket_name> --name <object_name>
Example:
oci os object head \ --namespace-name examplenamespace \ --bucket-name MyBucket \ --name eventslogreference.htm { "access-control-allow-credentials": "true", "access-control-allow-methods": "POST,PUT,GET,HEAD,DELETE", "access-control-allow-origin": "*", "access-control-expose-headers": "Content-Type,Etag,last-modified,Content-MD5,Content-Length,opc-client-request-id,opc-request-id,Access-Control-Allow-Origin,Access-Control-Allow-Methods,Access-Control-Allow-Credentials", "connection": "Keep-Alive", "content-length": "1363", "content-md5": "Ucf+fZbCK/RN5gGsEl7G5w==", "content-type": "application/octet-stream", "date": "Tue, 01 Jun 2021 18:05:32 GMT", "etag": "33ed1aff724eac56f00616552fc61f3e", "keep-alive": "timeout=5, max=100", "last-modified": "2021-06-01T17:57:16.000Z", "opc-client-request-id": "8965F8B5A9B84F00B51D4C965F029230", "opc-request-id": "txae7c2c9aa7094f16adee8-0060b676ec", "server": "Apache", "x-content-type-options": "nosniff" }
-
Creating a Folder or Subfolder
Using the OCI CLI
-
Gather the information you need to run the command.
-
Namespace (see Obtaining the Object Storage Namespace)
-
Bucket name (
oci os bucket list
), see Listing Buckets -
Object file location
-
Object name
-
-
Run this command.
Syntax:
oci os object put --namespace-name <object_storage_namespace> --bucket-name <bucket_name> --file <file_location> --name <object_name>
Example:
oci os object put \ --namespace-name examplenamespace \ --bucket-name Bucket1_objv-enabl \ --file /home/log_files/install.log \ --name /home/log_files/install.log
oci os object put \ --namespace-name examplenamespace \ --bucket-name Bucket1_objv-enabl \ --file myfile \ --name /home/log_files/install.log
oci os object put \ --namespace-name examplenamespace \ --bucket-name Bucket1_objv-enabl \ --file /home/log_files/install.log \ --name /home/log_files/install.log Uploading object [####################################] 100% { "etag": "bae04836d4ea5d521c23cbee70566cf2", "last-modified": "2021-05-13T15:37:18.000Z", "opc-content-md5": "GWZbZ8CXPCjLcPxBs6cPCQ==" }
Uploading an Object
Using the OCI CLI
An object can be uploaded as a single part or as multiple parts. Use the
--no-multipart
option to upload as a single part. For detailed
information on multipart uploads, see Performing a Multipart Upload.
-
Gather the information you need to run the command.
-
Namespace. See Obtaining the Object Storage Namespace.
-
Bucket name (
oci os bucket list
). See Listing Buckets. -
Object file location
-
-
Run the object put command.
Syntax (entered on a single line):
oci os object put --namespace-name <object_storage_namespace> --bucket-name <bucket_name> --file <file_location>
The value of <file_location> is the full path name of the object being uploaded, such as
C:\workspace\Uploads\MyFile.txt
or/home/user/Documents/Uploads/MyFile.txt
.If you specify the
--no-multipart
option, the file will upload as a single object with the same name as the source file.Example:
oci os object put --namespace-name examplenamespace --bucket-name MyBucket \ --file /home/user/Documents/Uploads/MyFile.txt --no-multipart Uploading object [####################################] 100% { "etag": "33ed1aff724eac56f00616552fc61f3e", "last-modified": "2021-06-01T17:57:16.000Z", "opc-content-md5": "Ucf+fZbCK/RN5gGsEl7G5w==" }
Performing a Multipart Upload
With multipart uploads, individual parts of an object can be uploaded in parallel to reduce the amount of time you spend uploading.
Multipart uploads accommodate objects that are too large for a single upload operation. Object parts must be no larger than 50 GiB.
You can pause between the uploads of individual parts, and resume the upload when your schedule and resources allow.
Using the OCI CLI
To upload an object, run oci os object put
with the
--part-size
flag. The --part-size
value represents the
size of each part in mebibytes (MiBs). Object Storage waives the minimum part size
restriction for the last uploaded part. The --part-size
value must be an
integer.
Optionally, you can use the --parallel-upload-count
flag to set the
maximum number of parallel uploads allowed.
-
Gather the information you need to run the command.
-
Namespace (see Obtaining the Object Storage Namespace)
-
Bucket name (
oci os bucket list
), see Listing Buckets -
Object file location
-
-
Run the command.
Syntax (entered on a single line):
oci os object put --namespace-name <object_storage_namespace> --bucket-name <bucket_name> --file <file_location> --parallel-upload-count <maximum_number_parallel_uploads> --part-size <upload_part_size_in_MB> --force
Example:
oci os object put \ --namespace-name examplenamespace \ --file /boot/initramfs-0-rescue-e542c19f0fbf4e41a41428d933a7357f.img \ --parallel-upload-count 5 \ --part-size 15 \ --force Upload ID: a21bba2c-8922-4b9c-a98a-9ef3569c0138 Split file into 6 parts for upload. Uploading object [####################################] 100% { "etag": "0964effc8dc4394fd317f03a025ae5d0", "last-modified": "2021-05-11T21:35:19", "opc-multipart-md5": "UIVRhiwSHY6o0E4pi/yfGg==-6" }
Listing the Parts of an Unfinished or Failed Multipart Upload
Using the OCI CLI
-
Gather the information you need to run the command.
-
Namespace (see Obtaining the Object Storage Namespace)
-
Bucket name (
oci os bucket list
), see Listing Buckets
-
-
Run this command.
Syntax (entered on a single line):
oci os multipart list --namespace-name <object_storage_namespace> --bucket-name <bucket_name>
Example:
oci os multipart list --namespace-name examplenamespace \ --bucket-name MyBucket \ { "data": [ { "bucket": "MyBucket", "namespace": "examplenamespace", "object": "MyObject", "time-created": "2019-07-25T21:55:21.973000+00:00", "upload-id": "0b7abd48-9ff2-9d5f-2034-63a02fdd7afa" }, { "bucket": "MyBucket", "namespace": "examplenamespace", "object": "MyObject", "time-created": "2019-07-25T21:53:09.246000+00:00", "upload-id": "1293ac9d-83f8-e055-a5a7-d1e13277b5c0" }, { "bucket": "MyBucket", "namespace": "examplenamespace", "object": "MyObject", "time-created": "2019-07-25T21:46:34.981000+00:00", "upload-id": "33e7a875-9e94-c3bc-6577-2ee5d8226b53" } ...
Canceling a Multipart Upload
Using the OCI CLI
-
Gather the information you need to run the command.
-
Namespace (see Obtaining the Object Storage Namespace)
-
Bucket name (
oci os bucket list
), see Listing Buckets -
Object name (
oci os object list
), see Viewing Objects in a Bucket -
Upload ID (
oci os multipart list
), see Listing the Parts of an Unfinished or Failed Multipart Upload
-
-
Run this command.
Syntax (entered on a single line):
oci os multipart abort --namespace-name <object_storage_namespace> --bucket-name <bucket_name> --object-name <object_name> --upload-id <upload_ID>
Example:
oci os multipart abort \ --namespace-name examplenamespace \ --bucket-name MyBucket \ --object-name MyObject \ --upload-id 22d5f6d2-8e03-48ca-8593-0192d25770b8 "data": [ { "etag": "dd434179cfbc22458a9739096ec43226", "md5": "PBrT093rZrcSDwQsKh9azQ==", "part-number": 13, "size": 15728640 } ], "opc-next-page": "00013" } WARNING: Are you sure you want to permanently remove this incomplete upload? [y/N]: y
Performing a Bulk Object Upload
Bulk operations at a specific level of the hierarchy do not affect objects in any level above.
Using the OCI CLI
-
Gather the information you need to run the command.
-
Namespace (see Obtaining the Object Storage Namespace)
-
Bucket name (
oci os bucket list
), see Listing Buckets -
Source directory location – is the upload directory path, such as
C:\workspace\Upload\ or /home/user/Documents/Upload
. If your source directory has subdirectories, the subdirectory names are prepended to the names of the files stored in those subdirectories, delimited with a forward slash (/
) character. For example, if a file namedmaple.jpg
is stored in the subdirectorytrees
, when the file is uploaded, Object Storage assigns the nametrees/maple.jpg
to the object.
-
-
Run this command.
Syntax (entered on a single line):
oci os object bulk-upload --namespace-name <object_storage_namespace> --bucket-name <bucket_name> --src-dir <source_directory_location>
Example:
oci os object bulk-upload --namespace-name examplenamespace \ --bucket-name MyBucket \ --src-dir /home/log-dir/ Uploaded Jan-logs [####################################] 100% Uploaded Feb-logs [####################################] 100% Uploaded Mar-logs [####################################] 100% Uploaded Apr-logs [####################################] 100% { "skipped-objects": [], "upload-failures": {}, "uploaded-objects": { "Jan-logs": { "etag": "33ed1aff724eac56f00616552fc61f3e", "last-modified": "2021-06-01T20:42:50.000Z", "opc-content-md5": "Ucf+fZbCK/RN5gGsEl7G5w==" }, "Feb-logs": { "etag": "e1875449257cc6ac6ab93cc9c7921c87", "last-modified": "2021-06-01T20:42:50.000Z", "opc-content-md5": "1B2M2Y8AsgTpgAmY7PhCfg==" }, "Mar-logs": { "etag": "c784ac5216d889f55138ecfb428eee3c", "last-modified": "2021-06-01T20:42:51.000Z", "opc-content-md5": "1B2M2Y8AsgTpgAmY7PhCfg==" }, "Apr-logs": { "etag": "3b4571c73bdb9e44bec0512a5e48fba7", "last-modified": "2021-06-01T20:42:51.000Z", "opc-content-md5": "1B2M2Y8AsgTpgAmY7PhCfg==" } } }
Copying an Object to a Different Bucket
You can copy an object to a different bucket as long as the target bucket is located in the same Private Cloud Appliance.
Using the OCI CLI
-
Gather the information you need to run the command.
-
Namespace (see Obtaining the Object Storage Namespace)
-
Bucket name (
oci os bucket list
), see Listing Buckets -
Name of the Source object (
oci os object list
), see Viewing Objects in a Bucket -
Name of the destination bucket (
oci os bucket list
), see Listing Buckets -
Name of the object in the new destination
-
-
Run this command.
Syntax (entered on a single line):
oci os object copy --namespace-name <object_storage_namespace> --bucket-name <source_bucket_name> --source-object-name <source_object> --destination-bucket <destination_bucket_name> --destination-object-name <destination_object_name>
Example:
oci os object copy --namespace-name examplenamespace --bucket-name MyBucket --source-object-name Compute_Logs.tar.gz --destination-bucket Bucket-log-backups --destination-object-name Compute_Logs.tar.gz.backup
Verify that the copied object is in the bucket.
oci os object list --namespace-name examplenamespace --bucket-name Bucket-log-backups { "data": [ { "etag": null, "md5": "XzYkstrjaprhbZyemalRbQ==", "name": "Compute_Logs.tar.gz.backup", "size": 132631, "time-created": "2021-04-01T21:00:55+00:00", "time-modified": null } ], "prefixes": [] }
Downloading an Object
Using the OCI CLI
-
Gather the information you need to run the command.
-
Namespace (see Obtaining the Object Storage Namespace)
-
Bucket name (
oci os bucket list
), see Listing Buckets -
Object name (
oci os object list
), see Viewing Objects in a Bucket -
Object file location
-
-
Run this command.
Syntax (entered on a single line):
oci os object get --namespace-name <object_storage_namespace> --bucket-name <bucket_name> --name <object_name> --file <file_location>
<file_location> is the destination path for the file being downloaded, such as
C:\workspace\Downloads\MyFile.txt
or/home/user/Documents/Downloads/MyFile.txt
.Example:
oci os object get \ --namespace-name examplenamespace \ --bucket-name MyBucket \ --name photos \ --file /home/photos_backup Downloading object [#-----------------------------------] 100% # ls -l total 8 -rw-r--r-- 1 root root 1363 Jun 1 17:56 photo1 -rw-r--r-- 1 root root 1363 Jun 1 21:40 photo1_backup -rw-r--r-- 1 root root 0 Jun 1 20:42 photo2 -rw-r--r-- 1 root root 0 Jun 1 20:42 photo3 -rw-r--r-- 1 root root 0 Jun 1 20:42 photo4
Performing a Multipart Download
Using the OCI CLI
-
Gather the information you need to run the command.
-
Namespace (see Obtaining the Object Storage Namespace)
-
Bucket name (
oci os bucket list
), see Listing Buckets -
Object name (
oci os object list
), see Viewing Objects in a Bucket -
Object file location
-
The byte-range for the download. Multipart object downloading is available using the byte-range request standard defined in RFC 7233, section 2.1
-
-
Run the command.
Syntax (entered on a single line):
oci os object get --namespace-name <object_storage_namespace> --bucket-name <bucket_name> --name <object_name> --file <file_location> --range bytes=<byte_range>
Example:
oci os object get \ --namespace-name examplenamespace \ --bucket-name MyBucket \ --name MyObject.mp4 \ --file c:\workspace\Downloads\MyObject.mp4 \ --range bytes=0-50 cusobjstorenamespace --range bytes=0-50 Downloading object [#-----------------------------------] 3% # ls -l total 12 -rw-r--r-- 1 root root 1363 Jun 1 17:56 abc.mp41 -rw-r--r-- 1 root root 51 Jun 1 21:50 def.mp4 -rw-r--r-- 1 root root 1363 Jun 1 21:40 ghi.mp4 -rw-r--r-- 1 root root 0 Jun 1 20:42 jkl.mp4 -rw-r--r-- 1 root root 0 Jun 1 20:42 mno.mp4 -rw-r--r-- 1 root root 0 Jun 1 20:42 pqr.mp4
Performing a Bulk Download
Using the OCI CLI
-
Gather the information you need to run the command.
-
Namespace (see Obtaining the Object Storage Namespace)
-
Bucket name (
oci os bucket list
), see Listing Buckets -
Download directory. <download_directory_location> is the destination path for the objects being downloaded, such as
C:\workspace\Downloads\
or/home/user/Documents/Downloads/
. If the directory does not exist, Object Storage creates the directory when the command runs.
-
-
Run the command.
Syntax (entered on a single line):
oci os object bulk-download --namespace-name <object_storage_namespace> --bucket-name <bucket_name> --download-dir <download_directory_location>
Example:
oci os object bulk-download \ --namespace-name examplenamespace \ --bucket-name MyBucket \ --download-dir c:\workspace\Downloads Downloaded MyFile.txt [####################################] 100% Downloaded logFile.log [####################################] 100% { "download-failures": {}, "skipped-objects": [] }
Deleting an Object
You can permanently delete an object from a bucket or folder. You cannot, however, recover a deleted object unless you have object versioning enabled. See Managing Object Versioning for details.
You cannot delete an object that has an active retention rule. See Defining Retention Rules for details.
Using the OCI CLI
-
Gather the information you need to run the command.
-
Namespace (see Obtaining the Object Storage Namespace)
-
Bucket name (
oci os bucket list
), see Listing Buckets -
Object name (
oci os object list
), see Viewing Objects in a Bucket
-
-
Syntax (entered on a single line):
oci os object delete --namespace-name <object_storage_namespace> --bucket-name <bucket_name> --object-name <object_name>
Example:
oci os object delete \ --namespace-name examplenamespace \ --bucket-name MyBucket \ --object-name MyFile.txt Are you sure you want to delete this resource? [y/N]: y
Performing a Bulk Delete of All Objects in a Bucket
Using the OCI CLI
-
Gather the information you need to run the command.
-
Namespace (see Obtaining the Object Storage Namespace)
-
Bucket name (
oci os bucket list
), see Listing Buckets
-
-
To see a list of the files impacted by a bulk delete command without actually deleting the files, use the
--dry-run
option.Syntax (entered on a single line):
oci os object bulk-delete --namespace-name <object_storage_namespace> --bucket-name <bucket_name> --dry-run
Example:
oci os object bulk-delete \ --namespace-name examplenamespace \ --bucket-name MyBucket \ --dry-run { "delete-failures": {}, "deleted-objects": [ "MyFile.txt", "logFile.log" ] }
-
To perform the bulk deletion:
Syntax (entered on a single line):
oci os object bulk-delete --namespace-name <object_storage_namespace> --bucket-name <bucket_name>
Example:
oci os object bulk-delete \ --namespace-name examplenamespace \ --bucket-name MyBucket WARNING: This command will delete 2 objects. Are you sure you wish to continue? [y/N]:y Deleted MyRenamedFile.txt [####################################] 100% Deleted logFile.log [####################################] 100% { "delete-failures": {}, "deleted-objects": [ "MyFile.txt", "logFile.log" ] }