If it ain’t broke, should it still be fixed?
Why do we need to use Docker, when serving a Jupyter notebook on AWS ain’t that hard? I had posted some past tutorials on this on Medium previously.
In this one, I will show how much more trivial the task can be when Docker is used. Just with two scripts that are at this repo, we will be able, in 3 steps do what we did above.
First, we need to set up an EC2 instance at AWS and SSH in. If you need details on how to do this, look here.
Once you are in, 4 lines of code will get you a Jupyter notebook up on AWS.
Clone my Github repo.
git clone https://github.com/playgrdstar/docker_jupyter.git
Get into the folder.
Run a bash script to install Docker and setup the necessary folders within.
Use docker-compose to setup a container with a Jupyter image, and run it.
docker-compose up -d
That’s it! Now, when you go to <ip>:8888, you will see the Jupyter notebook page.
We now just need the token to get in. All you need to do is to see the containers that are running, and get the name of the container.
Access the logs with the name of the container.
docker logs <container_name>
Now just copy and paste the token password in.
To stop everything, just do this.
That’s it. Easy peasy.
There is, of course, the matter of explaining the code in initialize.sh and docker-compose.yml, which I will go through in a subsequent post.