How to run TensorFlow on AWS EC2 for Windows 10

Original article was published on Deep Learning on Medium

Using your command line terminal, I will be using Git Bash,

cd ‘to the directory containing the pem file’

chmod 0400 any_name.pem

Then return to your EC2 instance page and copy your Public DNS (IPv4).

Now, in your command line run the following,

ssh -L localhost:8888:localhost:8888 -i any_name.pem ubuntu@ec2–52–14–135–50.us-east-2.compute.amazonaws.com

If you receive an error, check your security group and confirm that it accepts 8888 incoming.

Start by, clicking “Security Groups” under Network & Security.

Click your security group for instance.

Then “Edit Inbound rules”, add “new rule”, Custom TCP, Port range 8888, Source 0.0.0.0/0.

Save and you should see under inbound rules the following.

Now return to your command line. And run the same line as before.

ssh -L localhost:8888:localhost:8888 -i any_name.pem ubuntu@ec2–52–14–135–50.us-east-2.compute.amazonaws.com

Now you should be connected to EC2 and the following screen will be displayed.

Now to run jupyter notebook on EC2, run the following lines.

jupyter notebook --generate-config
jupyter notebook --i=0.0.0.0

Copy and paste the http address and save it any where. Then return to AWS EC2 Management Console and copy IPv4 Public IP.

Now, replace ip-172–31–4–23, with the IPv4 Public IP.

http://replace_with_IPv4_Public_IP:8888/?token=4f5837a4e0341945af8cb56993b3ca60ee1d9c83377e65e1

And run this address in your web browser.

The following jupyter notebook layout will load, and being writing a new file by clicking Python [conda env:tensorflow_p36].

  • p36 = python 3.6
  • tensorflow = tensorflow version < 2.0