Object Storage and Compute

Object storage is a service (as opposed to a virtual storage device or instance) that allows for easy uploading and access to objects from any compute instance within OCI. It is similar to Amazon’s S3 storage, but object storage is defined as part of a compartment (in the same way as compute, virtual networks, and block storage). When moving data from S3 to OCI Object Storage, you will need to specify compartments as well as buckets.

You can add data to an OCI Object Storage bucket via the web interface, through the CLI (command line interface), or through the Amazon S3 Compatibility API.

Steps

Create a bucket

Create a policy to allow access

Edit the policy to allow admins to be able to manage buckets as well as objects

Create an API Key from user profile

Note: You may wish to create a user with fewer rights than the admin user you are logged in as. Create the user with restricted access, log in as that user and create an API key.

Alternatively, a Pre-Authenticated Request (PAR) allows you to specify lower levels of access and an expiration date for access.

Copy the API Key and Configure the Compute Host

We need to copy this config (and the private key file) to the remote server

Create a .oci directory under /home/opc

sudo mkdir .oci

Create a config text file

sudo vi config

Copy the text from the configuration file preview into that file – we will need to change the path once we have uploaded the private API key to the server

Log out of the remote server, copy the API key file to the home directory, then sudo copy the file to wherever you want to store it.

NOTE – because I have setup SSH on my mac to use a connection string I can just invoke scp <name> rather than scp -i <key path> <username>@<ip address> …….

(You need to copy in two steps because the data drive is owned by root and you are remoting in as opc)

Edit the config file at /home/opc/.oci to reflect the location of the API key

NOTE – I created a folder called Keys on the data drive and put the API key in there to make the file storage neater

Test Connectivity

Upload some sample files to object storage to test the connectivity

Now go back to the compute node and see if we can copy files from object storage buckets to block storage

Success! With a couple of warnings

Let’s fix those warnings while we are here: