IBM Cloud Docs
Setting up the CLI

Setting up the CLI

Install, update, and delete the required CLIs and set up your environment to use IBM Cloud® Code Engine.

Supported environments for Code Engine CLI

The Code Engine CLI supports the following environments:

  • Linux 64 bit
  • Linux 64 bit ARM
  • Linux 32 bit
  • Mac OS X 64 bit
  • Mac OS X M1/ARM
  • Windows 64 bit
  • Windows 32 bit

Installing the IBM Cloud CLI

Install the latest version of the IBM Cloud CLI.

Before you begin

You must create an IBM Cloud account.

  1. Download and install the IBM Cloud CLI.

    This installation includes the following files:

    • IBM Cloud Functions plug-in
    • IBM Cloud Object Storage plug-in
    • IBM Cloud Container Registry plug-in
    • IBM Cloud Kubernetes Service plug-in

    For more information, see IBM Cloud CLI.

  2. Log in to the IBM Cloud CLI.

    ibmcloud login
  3. If you have more than one account, you are prompted to select which account to use. Follow the prompts or use the target command to select your IBM Cloud account.

    ibmcloud target -c <account_id>
  4. You must also specify a region. You can use the target command to target or change regions.

    ibmcloud target -r <region>
  5. You must specify a resource group. To get a list of your resource groups, run the following command.

    ibmcloud resource groups

    Example output

    Retrieving all resource groups under account <account_name> as
    Name      ID                                 Default Group   State   
    default   a8a12accd63b437bbd6d58fb8b462ca7   true            ACTIVE
    test      a8a12abbbd63b437cca6d58fb8b462ca7  false           ACTIVE
  6. Target a resource group by running the following command.

    ibmcloud target -g <resource_group>

    Example output

    Targeted resource group default

Installing the Code Engine CLI plug-in

Install the latest version of the Code Engine CLI.

Be sure that you installed the latest version of the IBM Cloud CLI. Otherwise, your Code Engine CLI installation might fail with a message similar to Could not find compatible binary to install for plug-in code-engine.

  1. Install the Code Engine plug-in.

    ibmcloud plugin install code-engine
  2. Use the ibmcloud plugin show code-engine command to verify that the plug-in is installed.

    ibmcloud plugin show code-engine

    Example output

    Plugin Name                              code-engine[ce]
    Plugin Version                           1.31.0
    Plugin SDK Version                       0.9.0
    Minimal IBM Cloud CLI version required   1.0.0
    Private endpoints supported              true
    code-engine,ce                    Manage Code Engine components.
  3. To run Code Engine commands, use ibmcloud code-engine or ibmcloud ce. To see everything that you can do with the Code Engine plug-in, run ibmcloud ce with no arguments.

    ibmcloud ce

Optionally, you can install the jq package. Many Code Engine commands include an option (--output JSON) to create JSON output. With this package, you can view and parse JSON responses from the command line.

For more information about Code Engine commands, see the ibmcloud ce commands.

Updating the Code Engine CLI

Update the CLI periodically to take advantage of new features.

  1. View your current plug-in list by running the ibmcloud plugin list command.

    ibmcloud plugin list

    Example output

    Listing installed plug-ins...
    Plugin Name                                  Version   Status             Private endpoints supported
    code-engine[ce]                              1.31.0                       true
    container-registry                           0.1.571                      true
    container-service[kubernetes-service]        1.0.408                      false
  2. If an update is available, run the ibmcloud plugin update command.

    ibmcloud plugin update code-engine

Uninstalling the CLI

If you no longer need the CLI, you can uninstall it.

  1. List the plug-ins that are installed.

    ibmcloud plugin list
  2. Uninstall the plug-ins. For example, to uninstall the Code Engine CLI plug-in:

    ibmcloud plugin uninstall code-engine
  3. Verify the plug-ins were uninstalled by running the following command and checking the list of the plug-ins that are installed.

    ibmcloud plugin list

The plug-ins that you deleted are not displayed in the results.

Accessing the IBM Cloud Shell in your web browser

With the IBM® Cloud Shell, you can use the IBM Cloud CLI and other CLI plug-ins directly from your web browser.

The IBM Cloud Shell is enabled with several plug-ins and tools, including the base IBM Cloud CLI (ibmcloud) and the Code Engine CLI.

While you use the Cloud Shell, keep in mind the following limitations.

  • You can open up to five concurrent sessions, which operate independently so you can work with different resources, regions, and accounts at once.
  • Any files that you download and edit locally, such as YAML files, are stored temporarily in the Cloud Shell and don't persist across sessions.
  • Cloud Shell has a usage quota that limits you to 50 hours within a week.

To launch and use the IBM Cloud Shell, in the IBM Cloud console menu bar, click the Cloud Shell icon IBM Cloud Shell icon. A session starts and automatically logs you in to the IBM Cloud CLI with your current account credentials.