Advertisement
fkeles

find-running-instances-oci-search.sh

May 10th, 2023 (edited)
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.16 KB | Cybersecurity | 0 0
  1. ## find running instances with display name like test
  2. ubuntu@FAKELES-7310:~$ oci search resource structured-search --query-text "QUERY instance resources where lifeCycleState = 'RUNNING' && displayName =~ 'test' && compartmentId = 'ocid1.compartment.oc1..<compartment-id>' " --query 'data.items[*].{name:"display-name",instance:"identifier"}' --output table
  3. +---------------------------------------------+---------+
  4. | instance                                    | name    |
  5. +---------------------------------------------+---------+
  6. | ocid1.instance.oc1.uk-london-1.<instance-id>| test-10 |
  7. | ocid1.instance.oc1.uk-london-1.<instance-id>| test-9  |
  8. | ocid1.instance.oc1.uk-london-1.<instance-id>| test-8  |
  9. | ocid1.instance.oc1.uk-london-1.<instance-id>| test-7  |
  10. | ocid1.instance.oc1.uk-london-1.<instance-id>| test-6  |
  11. | ocid1.instance.oc1.uk-london-1.<instance-id>| test-5  |
  12. | ocid1.instance.oc1.uk-london-1.<instance-id>| test-4  |
  13. | ocid1.instance.oc1.uk-london-1.<instance-id>| test-3  |
  14. | ocid1.instance.oc1.uk-london-1.<instance-id>| test-2  |
  15. | ocid1.instance.oc1.uk-london-1.<instance-id>| test-1  |
  16. +---------------------------------------------+---------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement