Ways to Upload Objects to Bucket in OCI
There are multiple ways in which you can upload Objects to OCI Object Storage Buckets.
In this blog, we will discuss few of the ways in which this can be achieved. Multi-Part upload, which is ideally used for huge files is not the scope of this blog and that is discussed in detail here by my colleague.
Before starting with this, you need to make sure that you have set IAM policies allowing you to WRITE objects to Bucket.
1. From OCI Console
This is the usual way where we login to OCI console → Storage → Buckets → Chose the Bucket → Upload → Click the object you want to upload from Local.
2. From OCI-CLI Console
You can run the command as below from your OCI-CLI:
oci os object put -ns <objectstorage-namespace> -bn <bucket-name> — file <location till the filename on your OCI CLI>
3. From OCI-CLI Installed in your local
Assuming that you have already installed OCI-CLI in your local and able to access.
Testing that OCI-CLI is installed on your local
oci os object put -ns <objectstorage-namespace> -bn <bucket-name> — file <location till the filename in your local>
4. Uploading from OCI-CLI using PAR URL created for the bucket.
Generate PAR URL on your bucket and run the below command:
curl <PAR URL> — upload-file test.py
5. Uploading from OCI-CLI using CURL without PAR URL
curl -v -X PUT -u <IDCS/IAM-User>:<AuthTokenValue>' --upload-file <file-name> https://swiftobjectstorage.us-phoenix-1.oraclecloud.com/v1/<ObjectStorage-Namespace>/<Bucket>/<file-name>
6. Uploading from OIC/VBCS
You can upload Objects to Objects to Object Storage using OIC, the process to achieve the same can be referred from here.
Similarly, you can achieve this functionality using VBCS, the process is described here.
7. Using OCI REST APIs for Object Storage
You can also leverage the OCI REST APIs provided for all the resources in OCI from here.
The authentication mechanism for OCI REST APIs are usually API Keys which are created for a user as shown below.
Please follow this blog to understand how to invoke OCI REST API using API Keys.
You can download objects from an OCI Bucket using OCI REST API & API Keys as shown below
You can also restrict which user can have access to which OCI Object Storage Bucket using OCI IAM Policies.
Allow group BucketUsers to use buckets in tenancy where target.bucket.name=’DemoBucket01’
8. Using Oracle APEX
You can create a simple & quick mobile/web application to access Object Storage buckets and upload/delete objects from it via the Oracle APEX application as explained in the YouTube video here.
NOTE: Please follow this link to know how to install OCI CLI.
!!Thanks, Happy Reading!!