IBM Cloud Docs
Getting started with IBM Cloud Shell

Getting started with IBM Cloud Shell

In this getting started tutorial, you use IBM® Cloud Shell to clone a sample Node.js app. IBM Cloud Shell is a cloud-based shell workspace that you can access through your browser. It's preconfigured with the full IBM Cloud CLI and tons of plug-ins and tools that you can use to manage apps, resources, and infrastructure.

New to Cloud Shell? Watch the demo video to see how quickly you can start using it from the IBM Cloud console.

Before you begin

  • If you don't already have an IBM Cloud account, sign up for one and log in.
  • Note the following account access information that might affect your access to Cloud Shell and its features:

Start a session in IBM Cloud Shell

In the IBM Cloud console, click the IBM Cloud Shell icon IBM Cloud Shell icon. A session starts and automatically logs you in through the IBM Cloud CLI.

Clone the Node.js sample app

Your Cloud Shell session starts in the temporary home directory, /home/<user-name>. Clone the Node.js Express sample app to this directory and then change to the sample app directory by running the following commands.

git clone https://github.com/IBM/nodejs-express-app.git
cd nodejs-express-app

From your app directory, run the following command to view the new files.

ls

You can see that your nodejs-express-app directory contains all of the sample app files and folders.

Dockerfile  Dockerfile-tools  LICENSE  README.md  package-lock.json
package.json  public  scripts  server  test

Preview the app locally

You can start it in Cloud Shell and preview it locally.

  1. First, download project dependencies for the Node.js sample app.

    npm install
    
  2. Start the app.

    npm run start
    

    When the app is running, it outputs the location where the app UI is available. For Cloud Shell, you only need to note the port, which in this case is 3000 .

    > nodejsexpressapp@1.0.0 start /home/my-user-name/nodejs-express-app
    > node server/server.js
    
    App UI available http://localhost:3000
    Swagger UI available http://localhost:3000/swagger/api-docs
    
  3. In the Cloud Shell menu bar, click the Web preview icon Web preview, and select port 3000.

    Your app preview opens in a new window. If you see the congratulations message, your app is running locally in Cloud Shell!

  4. Press Control+C to stop the app.

Next steps

From Cloud Shell, you can quickly run commands on your IBM Cloud account. For example:

In addition to the IBM Cloud CLI, Cloud Shell is preconfigured with all IBM Cloud CLI plug-ins and many tools and runtimes to help you work in the cloud. For the full list, see Installed plug-ins and tools.