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. Cloud Shell is 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 you can start to use the service 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:
- An account administrator can grant specific users access to Cloud Shell and its features, even if Cloud Shell settings are disabled at the account level. For more information, see Assigning access to Cloud Shell and its features at a user level.
- Account owners or users with Cloud Shell administrator access can enable or disable Cloud Shell features for an account. The available features in this release are File upload and download and Web preview. The feature settings apply only to the enabled Cloud Shell locations. For more information, see Enabling or disabling Cloud Shell features for an account.
- For more information, see IAM roles and actions.
Start a session in IBM Cloud Shell
In the IBM Cloud console, click the 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.
-
First, download project dependencies for the Node.js sample app.
npm install --only=prod
-
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 need to note only 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
-
In the Cloud Shell menu bar, click the Web preview icon , 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!
-
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.