Using the Cloud Foundry CLI

Objective

After completing this lesson, you will be able to use the Cloud Foundry Command Line Interface (CF CLI)

The Cloud Foundry Command Line Interface

Usage Scenario

You have an account in the SAP Business Technology Platform and you enabled the runtime in your subaccount. To manage the environment using a command line interface, you need to get familiar with the Cloud Foundry Command Line Interface (CF CLI).

Manage the Cloud Foundry Runtime

The CF CLI enables you to work with the Cloud Foundry Runtime to deploy and manage your applications. To manage the Cloud Foundry Runtime, you can use both the BTP cockpit and the CF CLI. Many actions can only be performed using the CF CLI - for example, renaming a Cloud Foundry org.

To install the CLI, you can either grab the latest release on the official release page or use https://tools.hana.ondemand.com/#cloud.

In order to manage the SAP Cloud Foundry Runtime, you need to provide the CF CLI with an API endpoint. The API endpoint depends on the region you chose for your account:

  • For EU: https://api.cf.eu10.hana.ondemand.com
  • For US EAST: https://api.cf.us10.hana.ondemand.com
  • For US CENTRAL: https://api.cf.us20.hana.ondemand.com

Note

You can find your specific API endpoint of your Cloud Foundry organization on your SAP BTP subaccount overview page. Always refer to them, and not to the previous examples shown here.
SAP BTP Cockpit Overview Page

To try this out, you can open a command prompt and enter the following commands (in this case for the EU region):

Code Snippet
Copy code
Switch to dark mode
123
cf api https://api.cf.eu10.hana.ondemand.com cf login

Enter your credentials and try it out.

If you want to have an overview of all commands, enter the following command:

Code Snippet
Copy code
Switch to dark mode
1
cf help -a

If you want to know the use of a special command - for example, rename-org to rename an org, enter the following command:

Code Snippet
Copy code
Switch to dark mode
1
cf help rename-org

CF CLI: Plug-ins

CF CLI: Plug-ins offers a list of additional commands that have been implemented as plug-ins to extend the base CF CLI client.

You can find examples of a CF CLI plug-in for performing operations on multi-target applications (MTAs) in Cloud Foundry, such as deploying, removing, viewing, and so on:

Summary

You now have a more profound understanding of the CF CLI to manage the Cloud Foundry environment.

Log in to track your progress & complete quizzes