Uploaded by SkillPedia

Lab 8 Working with OCI CLI

advertisement
Lab 8. Working with OCI CLI - Linux
Objectives:






Download and Install OCI CLI on your local VM, server.
Configure OCI CLI on local VM, server
Verify the working of OCI CLI on server.
Create VCN Resources using OCI CLI
Launch an Instance using OCI CLI
Create a Bucket using OCI CLI
Pre-Requisites


To sign in to the Console, you need the following:
o Tenant, User name and Password
o URL for the Console: https://console.us-ashburn-1.oraclecloud.com/
o Oracle Cloud Infrastructure supports the latest versions of Google Chrome,
Firefox or Internet Explorer 11
To Configure OCI CLI, internet must be working on the VM, server. There should be no
firewall blocking access to github and other websites.
Sequence 1. Install and Configure OCI CLI on Linux.
The Lab outcome will be used in other labs. So please be careful and complete all
steps.
1. Login to Linux Machine server, as root user.
2. To install OCI CLI on the compute instance, Enter Command:
# bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)"
If you are using Oracle Linux, you can simply use yum install python36-oci-cli
3. When prompted for Install directory, Press Enter (choose default)
4. When prompted for ‘oci’ directory, Press Enter (choose default)
5. When prompted for ‘Y/N’ for $Path, Enter Y, when prompted for path for rc file Press Enter
(choose default)
6. Check oci CLI installed version, Enter command:
# oci -v
7. Run the Configuration with command:
# oci setup config
Press Enter when prompted for directory name to accept the default. You will be prompted to
enter user OCID and tenant OCID.
8. Switch to OCI Console window, Click user icon and click User Settings. In User settings
click Copy next to OCID for your user name
9. Switch to the SSH terminal session and paste the user OCID using mouse/touch pad and
press Enter. You will be prompted to Enter Tenancy OCID
10. Switch to OCI Console window, Click user icon and click your Tenancy name, copy the OCID
as was done for user OCID. Also note down your region (for me “us-phoenix-1”)
11. Switch to the SSH terminal window and paste the tenancy OCID using mouse/touch pad and
press Enter. You will be prompted to enter your region.
12. Type your region and press Enter. Enter Y for ‘New RSA key pair’. Press Enter and accept
default options for directories. Press Enter when prompted for passphrase.
13. In the SSH terminal session for second compute and try these commands:
# cd /root/.oci
# ls
14. Verify the API key files and OCI CLI config files exist.
# cat config
Sequence 2. Upload API keys and verify functionality
1. In the SSH terminal window enter command:
# cat /root/.oci/oci_api_key_public.pem
Highlight the output, right click mouse/touchpad and click copy
2. Switch to OCI Console window, Click user icon and click User Settings. In User settings
click API Keys and Add Public Key.
3. Paste the content of oci_api_key_public.pem copied earlier and click Add. A new finger print
will be generated. Switch to the SSH terminal session and type:
# cat /root/.oci/config
Compare the finger print in the output of config file to the one in OCI console window and
make sure they match
4. In the SSH terminal session, type the following command:
# oci iam availability-domain list
This will list all availability domains in the current region. Make note of one of the availability
domain names. It should look something like this Luda:US-ASHBURN-AD-1. You will use
this in a future step.
Download