CLI Basics

In this section we will cover the basics of installing and using the CF command line interface (CLI).

Install the CLI

Select and install the appropriate installer for your laptop: github.com/cloudfoundry/cli

After the installer has finished, run the cf command

Checking Your Work

You should see output similar to the following:

NAME:
   cf - A command line tool to interact with Cloud Foundry

USAGE:
   [environment variables] cf [global options] command [arguments...
...

Notice that the CF CLI is self documenting. You can type any command with --help to see details. Typing cf only lists all available commands.

cf <some-command> --help

Log In

You can use the CLI to log into any Cloud Foundry you have an account in. `

Use cf help -a to find out how to login to Pivotal Web Services/The Swisscom Application Cloud/anynines public PaaS. The API endpoint you need for Pivotal Web Services is api.run.pivotal.io. The anynines public PaaS endpoint is https://api.de.a9s.eu. You can find the URL to use for The Swisscom Application Cloud by clicking on ‘Settings’ when looking at your space in the Swisscom UI.

Are you logged into Pivotal Web Services/The Swisscom Application Cloud/anynines public PaaS?

What org and space are you targeting?

Checking Your Work

You can see where you are logged in using cf target. You should see something similar to:

API endpoint:   https://api.endpoint.io
API version:    2.78.0
User:           me@example.com
Org:            my-org
Space:          my-space

Target Orgs & Spaces

You can change the org and space you are targeting without logging in again.

$ cf target -o ORG -s SPACE

Beyond the Class

© 2018 Copyright Cloud Foundry Foundation. All Rights Reserved.