You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Developing a bash wrapper for OCI Bastion: How to resolve Instance OCID from a Hostname Label?

Summary:
Hello! I am developing a bash wrapper for the OCI Bastion service to mimic standard SSH behavior (e.g., oci-ssh user@host).

Content (please ensure you mask any confidential information):

My instances have hostname labels assigned within a private subnet. While I can manually provide most arguments for oci bastion session create, I want my script to dynamically resolve the target-resource-id (Instance OCID) and target-resource-private-ip-address based solely on the provided hostname label.

My current logic:

  • Run oci bastion bastion get to retrieve the target-subnet-id.
  • Run oci network private-ip list --subnet-id to get all IPs in that subnet.
  • Filter the JSON by hostname-label using the

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!