Link Search Menu Expand Document

Command line examples for ibmcloud resource search

  • IaaS = Classic Infrastructure (SoftLayer) Resources.
  • Cloud = IBM Cloud Resources.

Search Cloud Resources (Cloud)

$ ibmcloud resource search 'name:devcluster'

Search by resource name and return CRN (Cloud)

$ ibmcloud resource search 'name:devcluster' --output json | jq -r '.items[].crn'

Search by resource tag (Cloud)

$ ibmcloud resource search 'tags:ryantiffany' --output json

Return resource names (Cloud)

$ ibmcloud resource search 'tags:ryantiffany' --output json | jq -r '.items[].name'

Return resource CRNs (Cloud)

$ ibmcloud resource search 'tags:ryantiffany' --output json | jq -r  '.items[].crn'

Return resource types (Cloud)

$ ibmcloud resource search 'tags:ryantiffany' --output json | jq -r  '.items[].type'

Search classic infrastructure (IaaS)

$ ibmcloud resource search -p classic-infrastructure --output json

Search classic infrastructure by tag (IaaS)

$ ibmcloud resource search "tagReferences.tag.name:ryantiffany" -p classic-infrastructure --output json

Return resource types (IaaS)

$ ibmcloud resource search "tagReferences.tag.name:ryantiffany" -p classic-infrastructure --output json | jq -r '.items[].resourceType'

Search by tag and filter on virtual instances (IaaS)

$ ibmcloud resource search "tagReferences.tag.name:ryantiffany _objectType:SoftLayer_Virtual_Guest" -p classic-infrastructure --output json 

Search IaaS Virtual instances by Tag and return FQDNs

$ ibmcloud resource search "tagReferences.tag.name:ryantiffany _objectType:SoftLayer_Virtual_Guest" -p classic-infrastructure --output json | jq -r '.items[].resource.fullyQualifiedDomainName'

Search IaaS Virtual instances by Tag and return instance ID’s

```shell $ ibmcloud resource search “tagReferences.tag.name: _objectType:SoftLayer_Virtual_Guest" -p classic-infrastructure --output json | jq -r '.items[].resource.id'