Provisioning and Administration with SAP HANA Cloud

Connecting using the Cloud Foundry CLI

Objectives
After completing this lesson, you will be able to:

After completing this lesson, you will be able to:

  • Log-in using the Cloud Foundry CLI

Log-in 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.

Download link: Cloud Foundry 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 will explain the Linux installation method, as my laptop is Debian/Ubuntu Linux based. The methods for Windows and Mac OS are explained on the page found here: Cloud Foundry 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
    wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add
    Copy code
    Note
    In this step you will be asked to provide your OS password
  3. Use the following command to add the package repository to your system:
    Code snippet
    echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
    Copy code
  4. Use the following command to update your local package manager information:
    Code snippet
    sudo apt-get update
    Copy code
  5. Use the following command to install the Cloud Foundry CLI:
    Code snippet
    sudo apt-get install cf8-cli
    Copy code

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 will 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 login 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
    
    cf login -a <API Endpoint URL>
    Example for SAP HANA Cloud Trial:
    cf login -a https://api.cf.eu10.hana.ondemand.com/
    Copy code

    A list with the available API Endpoint URLs can be found here: Available API Endpoints

  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
cf version
Copy code

Show the help documentation

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

Code snippet
cf help
Copy code

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

Code snippet

cf help [command]
Copy code

Example:

Code snippet
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
Copy code

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
cf services
Copy code

To view the service details use the command:

Code snippet
cf service <service name>
Copy code

Example:

Code snippet
cf service HC200-Trial-Database
Copy code

Find the Service Offerings and Service Plans

Services enable, facilitate, or accelerate the development of business applications and other platform services on SAP BTP. You find all services, solutions, and use cases in the SAP Discovery Center. 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.

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.

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.

Save progress to your learning plan by logging in or creating an account