Multipart Upload on OCI Bucket / Object Storage using OCI-CLI in Windows or Linux

Oracle OCI-CLI requires Python packages v 3.6 or higher. During installation it is auto installed on windows server/OS, however on Linux, there might be preinstalled Python package installed, that might need to be updated manually before running the installer. (In few cases, the installation failed and the package needed to be be updated seperately)

Installation on Linux

bash -c "$(curl -L"

For CentOS-7 few additional steops might needed-

sudo yum groupinstall 'Development Tools'
sudo yum install centos-release-scl
sudo yum install rh-python36
scl enable rh-python36 bash
yum -y install python-pip

afterwards, run the installer command mentioned above.

Installation on Windows

powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString(''))"

The instllation is pretty straight forward. Once installed, check the software versioning-

python --version
oci --version

Configuring OCI-CLI setup:

Run the following command:

oci setup config

It will prompt for several inputs to deliver-

  1. User OCID. You can find the user OCID from your oracle cloud console- profile > user information > OCID
    (sample- ocid1.user.oc1..aaaaaaaagw4ezrtj7wxmosqf3phqhdnv4i4jvhq4r6klz4j4u6w6587hielxa)
  2. Tenancy OCID. You can find it from- Hamburger menu > Governence & Administration > Tenancies > Click and expand tenancy name > Tenancy OCID
    (sample- ocid1.tenancy.oc1..aaaaaaaak2d5y4fmatd37zmetmvczzenxrhx4m6fn5yruiweyihfi6d7ittppb2a)
  3. Your Region to select: In my case it was, ap-mumbai-1
  4. Generate Key pair while the prompt asks, and use N/A while password promts appears.
  5. In my case my key pairs were generated in my windows path like- C:\Users\Rumi\.oci\oci_api_key_public.pem
  6. Open the oci_api_key_public.pem using notepad and copy the texts
  7. Now move to OCI cloud console and go Profile > OCIDProfile or alternatively from Hamburger menu > > Identity > Users > User Details > API Keys > Add API Keys
  8. Select Paste Puiblic Key, and paste the values copied in step 6

Configure your Object Storage

  1. Hamburger > Storage > Bucket > Click 3 dots at right side of your bucket > Select Pre Authenticated Request (PAR) > Select Bucket > Permit Object Reads

Run command in your powershell-

oci os ns get

A following sample reposne (namedspace) will generate

"data": "bmaHK;ftwtcdx"

Read and Write on bucjet using oci-cli:

Read Bucket Files with Name-size-date modified

oci os object list -bn <your-bucket-name> --query 'data[*].["name", "size", \"time-modified\"]' --output table

Read Bucket in json format:

oci os object list -bn <your-bucket-name>

Upload File to Bucket

oci os object put -bn <your-bucket-name> --file D:\<your-file> -ns "bmaHK;ftwtcdx"



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.