How to Launch a Jupyter Environment

We will explain how to create a dedicated Jupyter environment on mdxII and access it from your browser for computation.
No command-line operations are required until you use the Jupyter environment, so feel free to try it out.

Completed Example

How to Create

You can create the environment in three steps. If you cannot log in to the mdxII portal, please contact us via the inquiry form.  Step 1. Set Access Permissions for the Jupyter Environment (on the mdxII portal)  Step 2. Launch the Jupyter Environment (on the mdxII portal)  Step 3. Access the Jupyter Environment (on your local PC)

Step 1. Set Access Permissions for the Jupyter Environment (on the mdxII portal)

Goal of Step 1: Use the security group feature of mdxII to allow access to your Jupyter environment from your local PC.

1. Access the mdxII portal, click [Project] menu > [Network] panel > [Security Groups] tab. If unsure, you can also access from here.

2. Click the [+ Create Security Group] button.

3. Enter a name of your choice and click [Create Security Group]. Here, it is named “test-sg”.

4. Click the [+ Add Rule] button.

5. Enter the following items and click [Add]:

Rule Custom TCP Rule
Description Optional
Direction Ingress
Port to Open Port
Port 8888
(Note: Jupyter Notebook typically uses port 8888. You may change it if needed.)
Source CIDR
CIDR
(IP address to access the Jupyter environment)
0.0.0.0/0
Note: Allowing “0.0.0.0/0” enables access from any IP address, but this is highly insecure. We recommend restricting it to specific IPs such as your lab’s address.

6. The rule you created will appear in the list. This completes Step 1.

Step 2. Launch the Jupyter Environment (on the mdxII portal)

Goal of Step 2: Launch an instance (virtual server) from the mdxII user portal and start the Jupyter environment.

Step 2. Launch the Jupyter Environment (on the mdxII portal)

Goal of Step 2: Launch an instance (virtual server) from the mdxII user portal and start the Jupyter environment.

1. Access the mdxII portal, then click [Project] menu > [Compute] panel > [Instances] tab. If unsure, access from here.

2. Click the [Launch Instance] button.

3. In the [Details] tab, set the instance name. Set any name you prefer and click [Next]. In this example, the instance name is: jupyter

4. In the [Source] tab, choose the OS for the instance. This guide assumes you are using Ubuntu, so click the “↑” button next to “mdxII-Ubuntu-22.04-Server” and then click [Next].

5. In the [Flavor] tab, choose the configuration for the instance. Select the “vc1m2g” (1vCPU + 2GB RAM) option, click the [↑] button, and then click [Next].

Note: “vc1m2g” is the minimum configuration. If your Jupyter work involves heavy computation, consider choosing a larger configuration. Flavors marked with a yellow triangle exceed your project’s resource quota and cannot be used.

6. In the [Network] tab, select the network to connect the Jupyter environment to. Click the [↑] button next to “lustre-network”. Then click the [Security Group] tab.

7. In the [Security Group] tab, configure access rules for the Jupyter environment. The default “default” security group does not allow Jupyter access. Click the [↓] button next to “default” to detach it, then click the [↑] button next to the security group created in Step 1 to attach it. Then click the [Configuration] tab.

8. In the [Configuration] tab, enter the setup script for when the virtual server starts. Paste the following script into the custom script field and click [Launch Instance].

The content of the customization script is below. Note: `MDXIIJUPYTERTOKEN` is the token required to access the Jupyter environment. Feel free to change it to a value of your choice.

#cloud-config
package_update: true
packages:
  - python3-pip
  - git

users:
  - default
  - name: jupyter-user
    shell: /bin/bash
    groups: users
    home: /home/jupyter-user

runcmd:
  - su - jupyter-user -c "echo 'export PATH=$HOME/.local/bin:$PATH' >> ~/.bashrc"
  - su - jupyter-user -c "pip3 install --user jupyterlab"
  - su - jupyter-user -c "mkdir -p /home/jupyter-user/notebooks"
  - su - jupyter-user -c "echo 'cd /home/jupyter-user/notebooks' > /home/jupyter-user/start_jupyter.sh"
  - su - jupyter-user -c "echo '/home/jupyter-user/.local/bin/jupyter lab  --NotebookApp.token="MDXIIJUPYTERTOKEN" --ip=0.0.0.0 --no-browser &' >> /home/jupyter-user/start_jupyter.sh"
  - su - jupyter-user -c "chmod +x /home/jupyter-user/start_jupyter.sh"
  - su - jupyter-user -c '(crontab -l 2>/dev/null; echo "@reboot /home/jupyter-user/start_jupyter.sh") | crontab -'
  - su - jupyter-user -c "/home/jupyter-user/start_jupyter.sh"

9. Confirm that the created instance appears in the instance list and the status shows “Running”.

*It may take some time for the status to switch to “Running”.

10. In the instance list, click the “Associate Floating IP” button for your instance.

※ By assigning a Floating IP (global address), the Jupyter environment becomes accessible via browser.

11. On the Floating IP management screen, click the “+” button next to the IP address field.

12. In the Floating IP allocation screen, click the [Allocate IP] button.

13. The allocated IP address will now appear. Click the [Associate] button. Be sure to take note of the allocated IP address, as it will be used to access the Jupyter environment!

14. This completes Step 2. Confirm that the allocated IP address is shown in the instance list.

Step 3. Access the Jupyter Environment (on your local PC)

Goal of Step 3: Launch your browser on your local computer and access the Jupyter environment on mdxII.

1. Prepare the Floating IP you noted in Step 2. If you changed the Jupyter environment token, have it ready too.

If unsure, check the instance list screen.

2. Open any web browser and enter the URL as “http://(Floating IP):8888/lab” to access it. If the following screen appears, your Jupyter environment is ready. Enter the token (default is MDXIIJUPYTERTOKEN) to log in.

3. You can now perform computations in the Jupyter environment.