Summary
After creating a compute instance, I need to know what VNICs are available.
References
Find VNICs
The data returned by the oci compute image list-vnics
command can be returned in either tabular or JSON format. The tabular format is easier to scan, while the JSON can return all fields:
Create Table of All VNICs
To find what VNICs compute images have in the Sandbox compartment, run the following commands to return a subset of fields in a tabular format:
export sandbox_ocid=$( \ oci iam compartment list \ --name 'Sandbox' \ --query 'data[0].id' \ --raw-output \ ) oci compute instance list-vnics \ --compartment-id $sandbox_ocid \ --query 'data[*].{"Instance Name":"display-name",OCID:id,"Private IP":"private-ip","Public IP":"public-ip"}' \ --all \ --output table
Sample output is:
+-------------------+-----------------------------------------------------------------------------------------+------------+----------------+ | Instance Name | OCID | Private IP | Public IP | +-------------------+-----------------------------------------------------------------------------------------+------------+----------------+ | Sandbox public VM | ocid1.vnic.oc1.ap-sydney-1.abzxsljrmdbwvui6ojyck4je6tty3huincepn7sitgejznlf3ewjrv7mw4ra | 10.0.1.179 | 152.67.125.254 | +-------------------+-----------------------------------------------------------------------------------------+------------+----------------+
Create JSON File of All VNICs
To find what VNICs compute images have in the Sandbox compartment, run the following commands to return all fields in JSON format:
export sandbox_ocid=$( \ oci iam compartment list \ --name 'Sandbox' \ --query 'data[0].id' \ --raw-output \ ) oci compute instance list-vnics \ --compartment-id $sandbox_ocid \ --all \ >sandbox_vnic.json
The output has been uploaded as sandbox_vnic.json.