# Access IBM Cloud Shell and get the code

For this workshop we'll be using the IBM Cloud Shell as work environment. The IBM Cloud Shell is a cloud-based shell that you can access through your browser. It is preconfigured with the full IBM Cloud CLI and other 3rd party CLIs like OpenShift's `oc`, Helm's `helm`, Kubernetes' `kubectl`, etc. You can find the list of installed plug-ins [here](https://cloud.ibm.com/docs/cloud-shell?topic=cloud-shell-plugins-tools).

## Step 1: Setup the IBM Cloud Shell terminal session

When using the IBM Cloud Shell, no client side setup is required for this workshop, it comes with all necessary CLIs (command line tools).

In your browser, login to the [IBM Cloud](https://cloud.ibm.com) Dashboard. **Make sure you select your own account** in the account list at the top, then click on the IBM Cloud Shell icon.

This opens a new browser tab with your IBM Cloud Shell session.

![](/files/-MFGFfZqeujsNZIQgvcE)

Note: Your workspace includes 500 MB of temporary storage. This session will close after an hour of inactivity. If you don't have any active sessions for an hour or you reach the 50-hour weekly usage limit, your workspace data is removed.

You should see you personal ID as `Current account: [User]'s Account'`:

![](/files/-MFGFfZyIt37e1Uf30Ss)

If you want to perform this workshop locally on your own workstation, you need a local terminal and the following tools:

* [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
* [curl](https://curl.haxx.se/download.html)
* [kubectl](https://kubernetes.io/docs/reference/kubectl/overview/)
* [yarn](https://yarnpkg.com)
* [mvn](https://maven.apache.org/ref/3.6.3/maven-embedder/cli.html)
* [Node.js](https://nodejs.org/en/)
* Java 9 or higher

## Step 2: Get the Code

In the IBM Cloud Shell execute the following command:

```bash
git clone https://github.com/IBM/cloud-native-starter.git
cd cloud-native-starter/security
ROOT_FOLDER=$(pwd)
echo $ROOT_FOLDER
```

## Step 3. Get Access to Kubernetes

Open provided Kubernetes cluster again in your browser tab, with the IBM Cloud web console. Switch from your **own** account to the provided **IBM account**.

* Switch back to the  **1840867-IBM** account by clicking on the account selection drop down in the top navigation bar.

![](/files/-MFGFfkOkoaC5uoZXv7E)

* Click on your cluster.

![](/files/-MFGFfZvU-QQrUl9dBn_)

* Now select `Access` on the left-hand side, here you see all steps to access your Kubernetes Cluster in a terminal session. You can easily copy and paste the given commands.

![](/files/-MFGFfZx-BI8w1nKbJu5)

* Go back to the open browser tab the open Kubernetes Cluster in the IBM Cloud web console.
  1. Now select `Actions->Connect via CLI` on the right-hand side.

     ![](/files/-Ma3TmZh3Xq8cW4Nil1I)
* Now copy and paste all these commands in sequence in your open IBM Cloud Shell terminal session.

| Browser tab - IBM Cloud web console | Broswer tab - IBM CLoud Shell    |
| ----------------------------------- | -------------------------------- |
| ![](/files/-Ma3TmZiTrgcK-tEnzaJ)    | ![](/files/-MFGFfZyIt37e1Uf30Ss) |

*Note:* To access the pre-provisioned IBM Cloud Kubernetes Cluster, select the correct account (1840867-Advowork) during login.

Example:

```bash
Select an account:
1. Thomas Südbröcker's Account (641XXXXXXXXe) <-> 123456
2. Advowork (e2bXXXXXXXX4) <-> 1840867
Enter a number> 2
```

## Step 4. Create an environment variable `$MYCLUSTER`

* Enter the following command to display the name of your cluster, its ID, and a few other things.

```bash
ibmcloud ks cluster ls
```

Example output:

```bash
Name                             ID                     State      Created        Workers   Location    Version                   Resource Group Name   Provider
mycluster-ams03-b3c.4x16         bsk19dhd0efh3hp3b05g   normal     1 day ago      2         Dallas      1.17.9_1534               default               classic
```

* Create an environment variable $MYCLUSTER that contains the name of your cluster, e.g.

```bash
export MYCLUSTER=your_pre_provisioned_clustername
```

> Congratulations, you have successfully completed this the setup. Awesome :star:


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ibm-developer.gitbook.io/get-started-with-security-for-your-java-microservi/setup-the-ibm-cloud-environment/cloud_shell.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
