Monthly Archives: April 2015

running a ipython Notebook on AWS

I recently started using iPython notebooks …they are so cool! (http://ipython.org/notebook.html)… but it took some finagling to figure out how to get an ipython Notebook running on an AWS. I struggled with this some as my data was on an AWS server  and while I could “run” the ipython notebook on the server, I could not “view” it on my local browser ! My AWS server was on a VPC and setting up a profile_nbserver did not work.

Its a really neat hack:  the basic idea is that you use the AWS default settings (ie configuration from/home/ubuntu/.ipython/profile_default), not any particular  profile_nbserver setting (which is what the tutorials ask you to do.)  Essentially you  you want to  run the  ipython notebook loaclly on the AWS server and mirror it on your local machine. From what I understand, we are remote port forwarding, ie transferring a remote (AWS)  connection to your machine.

So after installing ipython on your AWS server;

  • On the AWS machine terminal run:  
    • ipython notebook  – this runs the the default configuration (not ipython notebook inline –profile=nbserver )
    • on your local machine type:                                                                                                                                                     ssh -L 9000:localhost:8888 ubuntu@ec2-xx-xx-xx-xx.us-west-1.compute.amazonaws.com (or whatever                                      your server public DNS name is) – oh and of course make sure you have a public IP address!
    • open your favorite browser and go to                                                                                                                                        http://localhost:9000/

and  Voila!! enjoy!

Advertisements