How to connect to AWS and open a Jupyter Notebook from Windows

Duc Minh
2 min readAug 23, 2019

--

In this tutorial, I will show you how to connect to an EC2 Ubuntu instance on Amazon Web Services (AWS) and open a Jupyter Notebook if you are using Windows.

Interestingly, even though it is a fairly basic technique, I have found no article on the internet so far that describes this process in detail for beginners. Even in the official documentation of AWS, instructions are given if you are using Mac or Linux, but not Windows. Therefore, I believe that this article will help beginners to quickly set up a Jupyter notebook on AWS so that they can get right on to development.

Step 1: Download and install Git Bash for Windows.

Step 2: Open Git Bash and connect to your AWS instance using SSH:

ssh -i myKey.pem ubuntu@PublicDNS

where myKey.pem is the directory to your private key when creating the EC2 instance, and PublicDNS is the public DNS of your ECS instance, and ubuntu is the default user name for an EC2 Ubuntu instance. An example of the command looks like this

ssh -i MyDocuments/key.pem ubuntu@ ec2–17–204–21–221.us-east-2.compute.amazonaws.com

An example of Step 2

Step 3: You should now be connected to your EC2 instance. Open a Jupyter Notebook by typing

jupyter notebook

Step 4: Open a NEW Git Bash and create an SSH tunnel by typing

ssh -i myKey.pem -L 8000:localhost:8888 ubuntu@PublicDNS

An example of this step is

ssh -i MyDocuments/key.pem -L 8000:localhost:8888 ubuntu@ ec2–19–204–21–221.us-east-2.compute.amazonaws.com

Step 5: Open your web browser and go to

localhost:8000

You should be able to see your Jupyter notebook at this point. If a token is required, go back to your first Git Bash and copy the token there. You can open a Jupyter notebook now.

Of course, there are other methods out there, such as using PuTTY or Bitvise SSH client. However, I found this method to be easier and more straightforward to use. Good luck to you guys and happy developing time.

--

--