This note about how to run jupyter notebook on aws ec2 and save your money and time.
If you want to do some experiment and you need a powerful machine, please welcome.

AWS spot instances can save you a lot of money.

Spot instances are often available at a discount compared to On-Demand pricing, you can significantly reduce the cost of running your applications, grow your application’s compute capacity and throughput for the same budget, and enable new types of cloud computing applications.

Let’s go!

Open aws console and request spot instance. You can use official AMI for deep learning:

  1. EU (Ireland) ami-41570b32
  2. US East (N. Virginia) ami-7cb9896b
  3. US West (Oregon) ami-edb11e8d

Pick instance type p2.xlarge, p2.8xlarge or p2.16xlarge for GPU computing and confirm spot request.

Wait for few minutes…

Connect to aws instance and run jupyter inside.

ssh -i aws-spot.pem [email protected]
sudo jupyter notebook

Note: you need to replace aws-spot.pem and with your values.

Open second terminal on your local machine and make ssh tunnel

ssh -f -i aws-spot.pem [email protected] \
-L -N

Now open jupyter is available here on your local machine. Tada!

Warning! Don’t forget to close ssh tunnel and cancel spot instance at the end.