Logging in Using Cloud Foundry CLI

Objective

After completing this lesson, you will be able to Sign in using the Cloud Foundry CLI.

Login Using the Cloud Foundry CLI

Using the Right Tool for the Job

SAP HANA Cloud provides powerful graphical tools to perform the database system administration tasks, but sometimes it can be useful to use a command line tool. The Cloud Foundry CLI provided the command line interface to SAP HANA Cloud.

The Cloud Foundry CLI can be used for:

  • Create an SAP HANA Database Instance Using the CLI
  • Create an SAP HANA Cloud, Data Lake Instance Using the CLI
  • Create a Connection Between an SAP HANA Database Instance and a Data Lake Instance Using the CLI
  • Recover an SAP HANA Database Using the CLI
  • Recreate Instance from Backup Using the CLI
  • Start and Stop an Instance Using the CLI
  • Delete an Instance Using the CLI
  • Delete a Connection Between an SAP HANA Database Instance and a Data Lake Instance Using the CLI
  • Change the Size of an SAP HANA Database Instance Using the CLI
  • Change the Size of a Data Lake Instance Using the CLI
  • Change Allowed Connections Using the CLI
  • Enable and Disable Additional Capabilities Using the CLI
  • Enable and Disable the Connectivity Proxy Using the CLI
  • List the Parameters of an Instance Using the CLI

The details on how to use the Cloud Foundry CLI commands will be explained the respective lessons.

Download the Cloud Foundry CLI

The Cloud Foundry CLI will be installed on your desktop. The installation media files for your operating system (Linux, Mac OS, and Windows) are available on GitHub. On GitHub, the installation packages for the most commonly used package managers are provided. Choose the newest version available for your operating system.

Cloud Foundry CLI download link: https://github.com/cloudfoundry/cli#downloads

Please only download from trusted sources.

Install the Cloud Foundry CLI

There are many ways to install the Cloud Foundry CLI. In this SAP Learning, I'll explain the Linux installation method, as my laptop is Debian/Ubuntu Linux based. The Cloud Foundry CLI installation guides for Windows and Mac OS can be found here: https://github.com/cloudfoundry/cli/wiki/V8-CLI-Installation-Guide

Install Instructions for a Debian/Ubuntu Distribution

  1. Open a Terminal window on your Linux system.
  2. Use the following command to download, and add the Cloud Foundry Foundation public key to your system:
    Code Snippet
    Copy code
    Switch to dark mode
    1
    wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add

    Note

    In this step, you'll be asked to provide your OS password.
  3. Use the following command to add the package repository to your system:
    Code Snippet
    Copy code
    Switch to dark mode
    1
    echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
  4. Use the following command to update your local package manager information:
    Code Snippet
    Copy code
    Switch to dark mode
    1
    sudo apt-get update
  5. Use the following command to install the Cloud Foundry CLI:
    Code Snippet
    Copy code
    Switch to dark mode
    1
    sudo apt-get install cf8-cli

You now have installed the Cloud Foundry CLI on your local desktop computer.

Getting Started with the Cloud Foundry CLI

Now that the Cloud Foundry CLI is installed, we can use it to perform many database administration tasks using this command line tool. In this section, you'll learn the basics of using Cloud Foundry CLI, in later units the detail SAP HANA Cloud database administration commands will be shown.

Log on to SAP HANA Cloud

You need to log in on SAP BTP before you can perform any of the SAP HANA Cloud database system administration tasks. To log on to SAP HANA Cloud, use the following steps:

  1. Open a Terminal window on your Linux system.
  2. Log on to the SAP BTP Cloud Foundry environment with the command:
    Code Snippet
    Copy code
    Switch to dark mode
    123
    cf login -a <API Endpoint URL> Example for SAP HANA Cloud Trial: cf login -a https://api.cf.eu10.hana.ondemand.com/

    A list with the available API Endpoint URLs can be found here: https://help.sap.com/docs/btp/sap-business-technology-platform/regions-and-api-endpoints-available-for-cloud-foundry-environment

  3. Enter your credentials (e-mail and password).

Show Cloud Foundry CLI Version

To check the version of the installed Cloud Foundry CLI, use the command:

Code Snippet
Copy code
Switch to dark mode
1
cf version

Show the Help Documentation

To get an overview of the available commands use the command:

Code Snippet
Copy code
Switch to dark mode
1
cf help

To get a detailed overview of how to use a specific command use the command:

Code Snippet
Copy code
Switch to dark mode
1
cf help [command]

Example:

Code Snippet
Copy code
Switch to dark mode
1234567891011
cf help services NAME: services - List all service instances in the target space USAGE: cf services ALIAS: s OPTIONS: --no-apps Do not retrieve bound apps information. SEE ALSO: create-service, marketplace

Find the Service Name of Your SAP HANA Cloud

An overview of the available services can be listed by running the following command:

Code Snippet
Copy code
Switch to dark mode
1
cf services

To view the service details, use the command:

Code Snippet
Copy code
Switch to dark mode
1
cf service <service name>

Example:

Code Snippet
Copy code
Switch to dark mode
1
cf service HC200-Trial-Database

Find the Service Offerings and Service Plans

Services enable, facilitate, or accelerate the development of business applications and other platform services on SAP BTP. On the SAP Discovery Center page, all the services, solutions, and use cases are listed. Link to the SAP Discovery Center page: https://discovery-center.cloud.sap/viewServices

Services are grouped into the following service types:

  • Business services: Services that enable, facilitate, or accelerate the development of business process components or provide industry-specific functionalities or content within a business application.
  • Technical services: Services that enable, facilitate, or accelerate the development of general or domain independent content within a business application, independent of the application's business process or task.
SAP BTP - Service Marketplace

When using the Cloud Foundry CLI, you often need to specify the technical name of the service offering and the service plan. The entitled service offering in your account can be found in the SAP BTP Service Marketplace, as shown the above figure.

Cloud Foundry CLI - Marketplace

It's also possible to retrieve the technical names of the service offerings and service plans using the Cloud Foundry CLI. Use the cf marketplace command to list the service offering and Service plans as shown in the above figure.

A service plan describes a particular service (for example, a database configuration) that is available for use. Service brokers advertise their service plans onto a catalog. You can use these advertised service plans to configure a particular service you want to create.

Log in to track your progress & complete quizzes