Table of Contents

Overview

OCI or Oracle Cloud Infrastructure is a cloud provisioning by Oracle which offers: PaaS, IaaS and others services. Firstly, to get access to OCI, we need Oracle account for OCI, which you can create for free at: “cloud.oracle.com” Like any other cloud infrastructure, there are whole books you can read of the architecture and the processes, but in a nutshell, you can think of it, as something like this:

Configuration

Once you have your account, your tenancy and your root compartment. It is important to set your configuration. The “config” file should be in your home location under the .ssh/ folder. Otherwise, you won't be able to connect. The configuration should have something like that.

Config file

[DEFAULT]
user=ocid1.user.__
fingerprint=2d:0d:__
tenancy=ocid1.tenancy.___
region=eu-frankfurt-1
key_file=<path to your private keyfile> # TODO

Of course, use yours user and tenancy OCIDs, as well as the private key of the public key you have added as API key.

Test

After that, you can test if you are set up, by listing your resources:

List all instances in your compartment

(poce_env) julien.andonov@julienandonovs-MacBook-Pro .oci % oci iam compartment list --compartment-id ocid1.tenancy.oc1..aaaaaaaa5ywubcssitfupa2xmwpwng2zms4dt52cw7gsbymr3nxesbkgdgrq

There are other commands which you can use as well:

OCI interface

###Get Namespace
oci os ns get


#Get tenancy
oci iam compartment list -c ocid1.tenancy.oc1..aaaaaaaa5ywubcssitfupa2xmwpwng2zms4dt52cw7gsbymr3nxesbkgdgrq

###Get Buckets:
oci os bucket list -ns frsg5o7pykju --compartment-id ocid1.tenancy.oc1..aaaaaaaa5ywubcssitfupa2xmwpwng2zms4dt52cw7gsbymr3nxesbkgdgrq

###Create bucket
oci os bucket create --compartment-id ocid1.tenancy.oc1..aaaaaaaa5ywubcssitfupa2xmwpwng2zms4dt52cw7gsbymr3nxesbkgdgrq --name testbucket

###Upload file
oci os object put -ns frsg5o7pykju -bn testbucket --name test.txt --file /Users/julien.andonov/Work/POCE/oci-ansible-collection/samples/compute/launch_compute_instance/test.txt


###List instance based on compartment
oci compute instance list -c ocid1.compartment.oc1..aaaaaaaawmkoyiqsxkalddfg3xxapwk22yovanosn766hjr2xwhk7td7zusa --lifecycle-state RUNNING | jq -r '.data[]."id"'