DEV Community

Ryan Tiffany
Ryan Tiffany

Posted on

1

Getting Started with IBM Cloud CLI Search

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'
Enter fullscreen mode Exit fullscreen mode

Search by resource name and return CRN (Cloud)

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

Search by resource tag (Cloud)

$ ibmcloud resource search 'tags:ryantiffany' --output json
Enter fullscreen mode Exit fullscreen mode

Return resource names (Cloud)

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

Return resource CRNs (Cloud)

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

Return resource types (Cloud)

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

Search classic infrastructure (IaaS)

$ ibmcloud resource search -p classic-infrastructure --output json
Enter fullscreen mode Exit fullscreen mode

Search classic infrastructure by tag (IaaS)

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

Return resource types (IaaS)

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

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 
Enter fullscreen mode Exit fullscreen mode

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'
Enter fullscreen mode Exit fullscreen mode

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


shell
$ ibmcloud resource search "tagReferences.tag.name:<tag> 
Enter fullscreen mode Exit fullscreen mode

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay