How do I get public IP from an OCI instance with OCI CLI?
There is a command from the docs - oci network public-ip get
but this expects parameters like --private-ip-id and -public-ip-id which also cannot be fetched using OCI CLI.
You can use list-vnics
oci compute instance list-vnics --instance-id <instance-ocid>
to list the interfaces for the instance. The interface details is a list and each entry contains the field "public-ip". You can use the following CLI command with jq to get the public IP address:
oci compute instance list-vnics --instance-id <instance-id> | jq -r '.data[]."public-ip"'