Hello and welcome to this video on Oracle Private Cloud Appliance.
In this video, you will learn about managing object versioning
on Oracle Private Cloud Appliance.
Object versioning provides data protection against accidental or malicious object updates,
overwrites, or deletions.
Object versioning is enabled at the bucket level.
Versioning directs Object Storage to automatically create an object version each time a new object
is uploaded, an
existing object is overwritten, or when an object is deleted.
You can enable object versioning at bucket creation time or later.
A bucket that is versioning-enabled can have many versions of an object.
There is always one latest version of the object and zero or more previous versions.
One potential use case for using object versioning is the versioning of static website pages
stored within a bucket.
We've covered the basics of object versioning, so let's begin!
I've already installed the OCI CLI so please refer to the video Configure
the OCI CLI.
I've already created a bucket and uploaded an object so see the video managing buckets
on oracle private cloud
appliance.
First, let's get a list of the buckets by running the command:
oci os bucket list --namespace-name docs
--compartment-id
From the output, we can see that my-bucket-01 is the bucket that was already created from
an earlier video.
Next, we need to determine the object versioning status for a bucket by running the command:
oci os bucket get --namespace-name <followed by the name of
the namespace> --bucket-name
From the results, we can see the state of the bucket versioning which is suspended.
Let's enable the bucket using the following command:
oci os bucket update --namespace-name
--compartment-id --bucket-name
--versioning enabled to enable object versioning
Let's now view the object versions and details by running the command:
oci os object list-object-versions --namespace-name
--bucket-name
oci os object list-object-versions --namespace-name docs --bucket-name my-bucket-01
As we can see, the version id is displayed along with timestamps for creation and modified.
Let's upload a new version of the object by running the command:
oci os object put --namespace-name followed by the object_storage_namespace
--bucket-name followed by the bucket_name --file followed by the file_location
--no-multipart which means upload in one file --force forcing the object to upload
Let's once again view the object versions and details:
oci os object list-object-versions --namespace-name
--bucket-name
oci os object list-object-versions --namespace-name docs --bucket-name my-bucket-01
We can see the the two versions now for the object myfile.txt
The first version has a size of 7 while the second version has a size of 15 with the additional
text added to myfile.txt.
Let's now delete the first version of the object by running the command:
oci os object delete --namespace-name
--bucket-name --version-id
--object-name --force which forces object deletion
Let's view the details of the my-bucket-01 object again by running the oci os object
list-object-versions command:
oci os object list-object-versions --namespace-name docs --bucket-name my-bucket-01
As you can see, the first version was deleted successfully since only the second version
with size 15 exists.
For more information, please check our additional information on Oracle Private
Cloud Appliance documentation or in the Oracle Private Cloud Appliance Learning
Library.
This concludes the video.
Thank you for watching.