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 getto retrieve thetarget-subnet-id. - Run
oci network private-ip list --subnet-idto get all IPs in that subnet. - Filter the JSON by hostname-label using the
Tagged:
0