Using AWS EC2 to build deep learning application
This blog is to demonstrate how to setup Deep learning environment on AWS with GPU support.
To use a pre-build environment, just follow these steps. If you want to setup environment yourself from scratch, you can refer to another article.
- Start an Amazon AWS account.
- Start a EC2 instance.
- Play with deep learning using jupyter notebook
To start up an AWS account,just follow the online guide
Amazon offers an EC2 instance that give you access to GPU support. Remember this instance is not free and charge 0.70 per hour. But you can build a spot instance to reduce your cost. About how to build a spot instance, you can refer Markus Beissinger' blog
So let's start an instance. First, choose your region as N.California ,because my AMI is stored on this region. Then you can Launch instances.When you are in AWS console. Fisrt,choose community AMIs tab and search for "fae6b49a" AMI.
Its name is DataScienceLab. I hava installed cuda,cudnn,anaconda,tensorflow,keras,theano,torch(pytorch),mxnet,caffe,lasgne in this environment with GPU support. So you can choose your favoriate tool later.
In the next page, choose g2.2xlarge Type. Then click next. When you are on step6, you need to add some type like this.
Through adding these rules, you can using jupyter notebook on the website.
Then,click review and launch.
If you launch instance on AWS first time, the system will ask you create a new key pair. You can also choose an existing key pair if you have build an instance before.
Once your instance is running, you can access it through SSH.
ssh -i EC2KeyPair.pem ubuntu@<your instance ip address>
So far, you have start a remote virtual machine on AWS. If all goes well ,you will see windows like this. To ensure the environment properties, you need to run these two command first.
source ~/.bashrc ## import the environment variables
conda info -e # check the virtual environments
As you see, this environment includes all famous deep learning framework. To choose your favorite framework, just run:
$ source activate <environment name>
Every environment has ipython installed. However it is still tough writing script in command model. To enable the jupyter notebook ,you need to run:
$ jupyter notebook
If there is no error, you can access the notebook server at ,the pin is "datasci"
Remember to include https:// in your address,or it doesn't work.
Congratulations! You have done with the environment. You can play with deep learning with your chosen framework.
Next ,I will write another article to show how to set up this environment from scratch.