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.
Open aws console and request spot instance. You can use official AMI for deep learning:
- EU (Ireland) ami-41570b32
- US East (N. Virginia) ami-7cb9896b
- 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@example.com sudo jupyter notebook
Note: you need to replace aws-spot.pem and 18.104.22.168 with your values.
Open second terminal on your local machine and make ssh tunnel
ssh -f -i aws-spot.pem firstname.lastname@example.org \ -L 127.0.0.1:3129:127.0.0.1:8888 -N
Now open jupyter is available here http://127.0.0.1:3129/ on your local machine. Tada!
Warning! Don’t forget to close ssh tunnel and cancel spot instance at the end.