Stop Worrying and Create your Deep Learning Server in 30 minutes
By: Rahul Agarwal
Tags: Programming, Deep Learning, Artificial Intelligence, Data Science, Machine Learning

Setting up Amazon EC2 Machine

I am assuming that you have an AWS account, and you have access to the AWS Console. If not, you might need to sign up for an Amazon AWS account.

First of all, we need to go to the Services tab to access the EC2 dashboard.

2. On the EC2 Dashboard, you can start by creating your instance.

3. Amazon provides Community AMIs(Amazon Machine Image) with Deep Learning software preinstalled. To access these AMIs, you need to look in the community AMIs and search for “Ubuntu Deep Learning” in the Search Tab. You can choose any other Linux flavor, but I have found Ubuntu to be most useful for my Deep Learning needs. In the present setup, I will use The Deep Learning AMI (Ubuntu 18.04) Version 27.0

4. Once you select an AMI, you can select the Instance Type. It is here you specify the number of CPUs, Memory, and GPUs you will require in your system. Amazon provides a lot of options to choose from based on one’s individual needs. You can filter for GPU instances using the “Filter by” filter.

In this tutorial, I have gone with p2.xlarge instance, which provides NVIDIA K80 GPU with 2,496 parallel processing cores and 12GiB of GPU memory. To know about different instance types, you can look at the documentation here and the pricing here.

5. You can change the storage that is attached to the machine in the 4th step. It is okay if you don’t add storage upfront, as you can also do this later. I change the storage from 90 GB to 500 GB as most of the deep learning needs will require proper storage.

6. That’s all, and you can Launch the Instance after going to the Final Review instance settings Screen. Once you click on Launch, you will see this screen. Just type in any key name in the Key Pair Name and click on “Download key pair”. Your key will be downloaded to your machine by the name you provided. For me, it got saved as “aws_key.pem”. Once you do that, you can click on “Launch Instances”.

Keep this key pair safe as this will be required whenever you want to login to your instance.

7. You can now click on “View Instances” on the next page to see your instance. This is how your instance will look like:

8. To connect to your instance, Just open a terminal window in your Local machine and browse to the folder where you have kept your key pair file and modify some permissions.

chmod 400 aws_key.pem

Once you do that, you will be able to connect to your instance by SSHing. The SSH command will be of the form:

ssh -i "aws_key.pem" ubuntu@<Your PublicDNS(IPv4)>

For me, the command was:

ssh -i "aws_key.pem" ubuntu@ec2-54-202-223-197.us-west-2.compute.amazonaws.com

Also, keep in mind that the Public DNS might change once you shut down your instance.

9. You have already got your machine up and ready. This machine contains different environments that have various libraries you might need. This particular machine has MXNet, Tensorflow, and Pytorch with different versions of python. And the best thing is that we get all this preinstalled, so it just works out of the box.