Overview
This guide will show you how to get started using the IBM Cloud CLI resource search function to locate resources on your account.
The examples are divided in to two sections:
- Cloud = IBM Cloud Resources.
- IaaS = Classic Infrastructure (SoftLayer) Resources.
If you do not have the IBM Cloud CLI installed you can refer to this doc for installation instructions. Alternately you can use IBM Cloud Shell which has all of the tools we will need out of the box.
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:<tag>
Top comments (0)