OCI CLI configuration

0

On Linux 8

dnf -y install python36-oci-cli

https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/cliinstall.htm#InstallingCLI__oraclelinux8

sudo dnf -y install oraclelinux-developer-release-el8
sudo dnf install python36-oci-cli

On Linux 7

bash -c “$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)”

Below steps are common on linux 8 and linux 7

mkdir /root/.oci
chmod 700 /root/.oci

ssh-keygen -t rsa -b 4096 -m pem -f privkey.pem
openssl rsa -in privkey.pem -pubout

When you run the CLI from a VM, the tool needs to connect to the OCI, to be able to run the commands you want. The OCI must be able somehow to authenticate you. For this authentication to take place, you need to create the API Key, with the option of using the public key that you just extracted in step 2. In the OCI console, under My Profile navigate to API Keys, and click on Add API Key, by selecting Paste Public Key option, and paste the public key extracted above. Click Add.

vi config

[DEFAULT]
user=ocid1.user.oc1..aaaaammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
fingerprint=4f:48:42:df:32:c5:46:54:f2:a9:fd:b9:07:85:58:33
tenancy=ocid1.tenancy.oc1..ddddddddddddddddddddddddddddddddddddddddddddddd
region=us-ashburn-1
key_file=/root/.oci/privkey.pem

chmod 400 config

oci iam compartment list

oci os ns get

Bulk upload
oci os object bulk-upload –namespace idwab9ffbqfz –bucket-name RMAN –src-dir /home/opc

Downloading and uploading
oci os object get -ns idwab9tfbqfz -bn BackupBucket –name R12SIT.tar.gz –file R12SIT.tar.gz
oci os object put -ns idwab9tfbqfz -bn TEST –name EBSapps_21jun23 –file EBSapps_21jun23.tar.gz

Share.

About Author

Leave A Reply