← All posts

Simplifying OCI CLI Setup with oci setup bootstrap

Skip manual config copy-paste and use the faster, safer bootstrap flow for first-time OCI CLI setup.


Traditional Setup

The first-time OCI CLI setup used to be one of those tasks that looked simple and wasted 30-45 minutes anyway.

The official OCI CLI Configuration flow asked you to build ~/.oci/config manually by copying values from the admin console.

~]$ oci setup config
    This command provides a walkthrough of creating a valid CLI config file.

    The following links explain where to find the information required by this
    script:

    User API Signing Key, OCID and Tenancy OCID:

        https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm#Other

    Region:

        https://docs.cloud.oracle.com/Content/General/Concepts/regions.htm

    General config documentation:

        https://docs.cloud.oracle.com/Content/API/Concepts/sdkconfig.htm


Enter a location for your config [/Users/hiran.patel/.oci/config]:

Ugh..

This is not the way…

Bootstrapping the Config

My first instinct was to script this in Python. Before doing that, I checked oracle/oci-cli and found the better option already existed.

Enter: ~]$ oci setup bootstrap

SETUP_BOOTSTRAP(1)         OCI CLI Command Reference        SETUP_BOOTSTRAP(1)

NAME
       setup_bootstrap -

DESCRIPTION
       Provides  an  interactive  process  to  create  a CLI config file using
       username / password  based  login  through  a  browser.   Also  handles
       generating   API   keys   and  uploading  them  to  your  Oracle  Cloud
       Infrastructure account.

       Note that port 8181 must be available in  order  for  this  command  to
       complete properly.

USAGE
          oci setup bootstrap [OPTIONS]

This command is faster, cleaner, and safer than manual copy/paste config setup.

Key Takeaways

  • Use oci setup bootstrap instead of manual configuration
  • Port 8181 must be available for the bootstrap process
  • Automatic API key generation and uploading reduces manual steps
  • Browser-based authentication is more secure than copying/pasting credentials