miércoles, 22 de abril de 2020

How to Install Oracle Cloud Infrastructure CLI in Windows

In order to Install CLI, we will need three things:

  1. Tenancy's OCID
  2. User OCID
  3. RSA Key pair in PEM format



    Obtaining  Tenancy's OCID:

    In the main manu, Click on "Administration" -> "Tenancy Details":


    Copy the OCID of your Tenancy:




    Obtaining User OCID:

    In the main manu, Click on "Identity" -> "Users":




    Copy the User OCID:



    Obtaining RSA Key pair in PEM format



    You can create the public and private keys by your own, or you can create it automatically during the process of CLI installation and configuration. In this example, I will let the configuration to create them.


    Installing CLI in Windows:


    Open PowerShell as Administrator:



    Execute the following Lines:


    To configure the remote execution policy for PowerShell, run the following command.

    Set-ExecutionPolicy RemoteSigned

    To run the installer script, run the following command.

    powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.ps1'))"

    You will be asked for the values of some parameters, answer properly. An example of the output is the following:





    Python will start to be installed:


    Then CLI will be installed:





    In order to get all the environment with the CLI tool, re-open the Power Shell.

    Now it's time to configure CLI, here is where the public key and private key will be generated:

    Execute the command: 

    oci setup config

    You will have to provide the Tenancy OCID and User OCID, at the beginnnig of this article we got them:




    The public and private key will be generated:



    Now it's time to upload the Public Key and link it to our User in the Oracle Cloud web console:



    In the main manu, Click on "Identity" -> "Users":




    Click on the User and then click on the button "Add Public Key":




    Upload the Public Key we just created with the OCI configuration:



    Now, OCI CLI is ready to be used.

    Let's test it:

    Getting the Namespace with the command:

    oci os ns get



    Getting the Compartments with the command:

    oci iam compartment list




    Checking our Object Storage Bucket with the command:

    oci os bucket list --compartment-id ocid1.tenancy.oc1..*** --namespace-name idt6zjv16ewi




    7 comentarios:

    Oracle ACE Director Award - Deiby Gómez

    Thanks #OracleACE Program for this awesome certificate recognizing the work I have done in the community for the last year. Looking forwa...