I haven’t posted this blog for a while because of coronavirus crisis. I do study programming and technology on a daily basis but I spend other time to follow and be alert about the current situation. Protecting my family is my first priority.
Engineers out there, please take care of yourself. Even if you think you are going to be OK because you are not in the risky age bracket, you might affect others. Please stay home as much as you can.
I just heard of a news that Shimura Ken (the most famous Japanese comedian) passed away today. This is the saddest news I have heard in a while.
I’m getting really into OCI (Oracle Cloud Infrastructure) CLI (Command Line Interface). It’s really cool to be able query and manipulate the Oracle Cloud Infrastructure resources. First, let’s see how we can install it.
Copy the following command and paste it in your terminal.
Pretty much all default values will do when prompted to enter information and the install is complete when you execute the next command.
$ source ~/.bashrc # ~/.bash_profile if macOS.
Depending on your environment, have your shell read the correct source.
Enter the following command to start to configure.
$ oci setup config
You will be prompted to choose where you want to store the configuration file for OCI CLI. I usually leave it at the default location, so simply hit enter (return) here.
Enter a location for your config [/home/amaterasu48/.oci/config]:
Now you will be prompted to enter user OCID. First login to OCI UI and click the Profile menu icon. And then select User Settings. By the way, OCID is resource identifier throughout Oracle Cloud Infrastructure. For more details, please refer to this documentation.
Then copy your OCID to your clipboard by clicking Copy link.
Back in your terminal, paste the copied user OCID and then hit enter.
Enter a user OCID: [Paste your user OCID here]
Next, you will be prompted to enter tenancy ID. Tenancy is equivalent to account. Click Profile -> Tenancy: [your tenancy name]
Now click Copy link to copy the Tenancy OCID.
Back in your terminal, paste the copied Tenancy OCID and then hit enter.
Enter a tenancy OCID: [Paste your tenancy OCID here]
Now you will be asked to enter the default region. All the available regions are listed in the prompt. I am entering us-ashburn-1 as my default region.
Enter a region (e.g. ap-melbourne-1, ap-mumbai-1, ap-osaka-1, ap-seoul-1, ap-sydney-1, ap-tokyo-1, ca-toronto-1, eu-amsterdam-1, eu-frankfurt-1, eu-zurich-1, me-jeddah-1, sa-saopaulo-1, uk-gov-london-1, uk-london-1, us-ashburn-1, us-gov-ashburn-1, us-gov-chicago-1, us-gov-phoenix-1, us-langley-1, us-luke-1, us-phoenix-1): us-ashburn-1
Now you will be prompted to generate private and public key pair. Enter Y to proceed.
Do you want to generate a new RSA key pair? (If you decline you will be asked to supply the path to an existing key.) [Y/n]: Y
The key files will be generated to ~/.oci directory. You have a chance to change the directory where you generate them but I would leave it to the default location. Simply hit enter here.
Enter a directory for your keys to be created [/home/amaterasu48/.oci]:
You are not prompted to enter a name for the key. I would just leave it as default. Hit enter.
Enter a name for your key [oci_api_key]:
Next, you will be asked to enter a passphrase for the private key. This is optional, so it’s up to you whether you enter a passphrase or not. I’m leaving it blank in this example.
Enter a passphrase for your private key (empty for no passphrase):
Copy the public key to your clipboard.
$ cat ~/.oci/oci_api_key_public.pem
Back in Oracle Cloud Infrastructure UI, navigate to User Settings.
Click Add Public Key button.
Click PASTE PUBLIC KEYS, paste the copied public key from ~/.oci/oci_api_key_public.pem in the PUBLIC KEY text area and finally click Add button.
Back in your terminal, execute the following lines to check if your OCI CLI can actually talk to Oracle Cloud Infrastructure.