The Cloud Foundry Command Line Interface (CLI)
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 SAP BTP cockpit and the CF CLI. Many actions can only be performed using the CF CLI, for example, renaming a Cloud Foundry org. The CF CLI is, therefore, an essential tool for SAP BTP developers, since it's very handy for managing your Cloud Foundry instances, applications and services. The aim of this lesson is not to give you a full overview of the CF CLI, but to provide you with a starting point for using it. The official Cloud Foundry documentation provides a comprehensive guide to the CF CLI, which you can find here.
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 BTP, Cloud Foundry runtime, you need to provide the CF CLI with an API endpoint. The API endpoint depends on the region and data center you chose for your subaccount.
For example (AWS regions):
- 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.
Example Commands
Here are some example commands to get you started with the CF CLI:
123cf api <your-api-endpoint>
cf login
The cf api command sets the API endpoint for the CF CLI, while the cf login command logs you into the CF CLI using your SAP BTP credentials.
You can also log in using single sign-on (SSO) by running: cf login -sso.
This command will open a browser window where you can authenticate with your SAP BTP credentials and retrieve an access token for the CF CLI.
For printing the available command pallet, you can use: 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: cf help rename-org.
CF CLI Plugins
The CF CLI can be extended via plugins. The CF CLI: Plugins page in the documentation offers a list available SAP plugins that have been implemented as plugins to extend the base CF CLI client.
You can find examples of a CF CLI plug-in for performing operations on multitarget applications (MTAs) in Cloud Foundry, such as deploying, removing, viewing, and so on: MTA-Plug-in for Cloud Application Programming.
Summary
With the CF CLI you can manage your Cloud Foundry instance, manage your applications lifecycle, subscribe to services and bind them to your applications, and much more. The CF CLI is a powerful tool that allows you to interact with the SAP BTP, Cloud Foundry runtime in a flexible and efficient way.
Tutorials
Install the Cloud Foundry Command Line Interface (CLI)
Check out the following tutorial: Install the Cloud Foundry Command Line Interface (CLI).
Install the MultiApps Cloud Foundry CLI Plugin
Check out the following tutorial: Install the MultiApps Cloud Foundry CLI Plugin.