# Jetstream 2 tutorial

{% hint style="warning" %}
Requires a Duke NetID and registration with the Duke Campus Champions allocation. Registration for the Intro to Supercomputing workshop will automatically give you access to the allocation.&#x20;
{% endhint %}

## Jetstream 2

Jetstream2 is a cloud-based infrastructure designed to support research, education, and scientific computing. It provides virtual machines and storage resources, allowing users to easily access and manage customized computing environments for a wide range of applications. Jetstream2 is particularly useful for those who need flexible and scalable computing resources without the complexity of traditional high-performance computing (HPC) systems. It supports projects in various fields such as data analysis, modeling, and research collaboration, making advanced computing more accessible to the academic community.

## login to Jetstream

<figure><img src="https://3610173103-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiTvAlZlFV3dZQlUPA0G1%2Fuploads%2FzigrksoXAM1BQrJxmhzc%2FScreenshot%202024-09-24%20at%201.31.44%E2%80%AFPM.png?alt=media&#x26;token=fee7e69f-4805-450f-9428-55c8020b0dfb" alt=""><figcaption></figcaption></figure>

Go to <https://jetstream2.exosphere.app/exosphere/home>

click add allocation

<figure><img src="https://3610173103-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiTvAlZlFV3dZQlUPA0G1%2Fuploads%2FYtWn4ss9einKemhYyJrg%2FScreenshot%202024-09-24%20at%201.31.58%E2%80%AFPM.png?alt=media&#x26;token=fcada4d2-7dc1-417d-9bcb-2f5c16e74394" alt=""><figcaption></figcaption></figure>

click add ACCESS account&#x20;

<figure><img src="https://3610173103-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiTvAlZlFV3dZQlUPA0G1%2Fuploads%2FJabQdvO5haUN3buyaxJK%2FScreenshot%202024-09-24%20at%201.32.07%E2%80%AFPM.png?alt=media&#x26;token=41b1139c-3fae-4333-b298-380f7a45400f" alt=""><figcaption></figcaption></figure>

&#x20;select Duke as the provider

<figure><img src="https://3610173103-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiTvAlZlFV3dZQlUPA0G1%2Fuploads%2Fzr4ZK3uVV1FMj8ncTnnP%2FScreenshot%202024-09-24%20at%201.32.33%E2%80%AFPM.png?alt=media&#x26;token=75cb5237-0978-429e-9804-60b6c24e4f0b" alt=""><figcaption></figcaption></figure>

Registering for the intro to supercomputing workshop should have added you to the Duke Campus Champion allocation. Email <sanjeev.chauhan@duke.edu> if you are not part of it.&#x20;

<figure><img src="https://3610173103-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiTvAlZlFV3dZQlUPA0G1%2Fuploads%2FptepTVPojLWSSVsTq40A%2FScreenshot%202024-09-24%20at%201.32.57%E2%80%AFPM.png?alt=media&#x26;token=2f8d992d-27b8-44ae-8a73-ae05b20157a0" alt=""><figcaption></figcaption></figure>

Create a new instance, add a name, pick ubuntu 22.04 and pick the smallest parameters as shown below.&#x20;

<figure><img src="https://3610173103-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiTvAlZlFV3dZQlUPA0G1%2Fuploads%2FmIsm2BihLYX1BJbQMbth%2FScreenshot%202024-09-24%20at%201.33.34%E2%80%AFPM.png?alt=media&#x26;token=eb3002ea-3745-4ccb-bc8a-3e21171e3648" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3610173103-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiTvAlZlFV3dZQlUPA0G1%2Fuploads%2FEZhXcmsxa9s8gqKYyZSu%2FScreenshot%202024-09-24%20at%201.34.19%E2%80%AFPM.png?alt=media&#x26;token=e8f0a4fc-5038-40fb-a1f8-792afb7f5074" alt=""><figcaption></figcaption></figure>

Wait for your instance to build and then click connect to and web terminal to connect to it.&#x20;

## Launching Jupyter on Jetstream2

**Using Web Desktop in Exosphere**

For a seamless experience with Jupyter notebooks on Jetstream2, initiate an instance through Exosphere, ensuring the web desktop option is activated.

1. Start an instance and wait for allocation.&#x20;
2. Launch a web terminal or ssh into the machine.

**Accessing Jupyter through Web Shell or SSH Session**

Given that a virtual machine is generally unaware of its public IP, Jetstream2 provides a script that retrieves your VM’s IP and integrates it into the URL provided by Jupyter.

To remotely initiate Jupyter via web shell or SSH:

1. Input the commands:

   ```bash
   module load anaconda
   jupyter-ip.sh
   ```
2. You should observe an output concluding with details resembling:

   ```
   To access the notebook, open this file in a browser:
       file:///home/exouser/.local/share/jupyter/runtime/nbserver-100997-open.html
   Or utilize one of these URLs:
       http://neatly-trusting-chow-gui:8888/?token=723fa5a01f6dc27b0ec655846572513757e921aaf247cbb7
   or http://149.165.154.8:8888/?token=723fa5a01f6dc27b0ec655846572513757e921aaf247cbb7
   ```
3. The final URL with the IP address (e.g., `149.165.xxx.xxx`) is the link you'll require for your browser.

#### Managing and Accessing  Instances

**SSH Access to the virtual machine**

To SSH into an Exosphere instance:

1. Obtain the public IP address of your instance from the Exosphere dashboard.
2. Use your terminal or SSH client with the command:

   ```bash
   ssh [username]@[instance_IP_address]
   ```

**Using the Virtual Desktop**

Exosphere provides a virtual desktop option for a more interactive experience. To utilize the virtual desktop:

1. Navigate to your Exosphere dashboard.
2. Select your active instance and click on the "Web Desktop" option.
3. This will open a new window with a full desktop environment accessible via your browser.

**Managing Instance Credits**

To optimize your ACCESS credits:

* **Shelving:** When not using an instance, you can "shelve" it. This action temporarily suspends the instance, preserving its state but not consuming credits.
* **Resizing:** Exosphere allows resizing of instances based on your needs. If you require more or fewer resources, navigate to the instance settings and select a different size. This flexibility ensures you only consume credits based on your actual resource requirements.
