Train Deep Learning Model with R Studio in AWS EC2

AWS provides us with approachable GPU based cloud computing capability with minimal cost.

We will talk about the steps to take advantage of AWS EC2 to build GPU computing for our model training in R.

1.  Register AWS account…

2. Find EC2 service

Screen Shot 2017-04-27 at 9.13.18 PM.png

3. Click “launch instance” and go for this one labeled Free tier eligible and HVM:

Screen Shot 2017-04-27 at 9.14.48 PM.png

4. check the default option and go for “Configure Instance Details”

Screen Shot 2017-04-27 at 9.15.51 PM.png

5. Next page, in advanced details, input the following text:Screen Shot 2017-04-27 at 9.17.40 PM.png

#install R
yum install -y R
#install RStudio-Server
yum install -y --nogpgcheck rstudio-server-rhel-0.99.465-x86_64.rpm
#install shiny and shiny-server
R -e "install.packages('shiny', repos='')"
yum install -y --nogpgcheck shiny-server-
#add user(s)
useradd username
echo username:password | chpasswd

0.99.465 is the version of R studio, pls find the latest one to replace it.
change the username and password to your desired name and pw.

6. click “review and launch”, go to “Security Groups”. Add Rule and edit as following:

Screen Shot 2017-04-27 at 9.29.52 PM.png

7. Review and Launch and click  “launch”, and on the popped up window select create a new key pair. Name the pair and download it and save it.Screen Shot 2017-04-27 at 9.23.40 PM.png

7. Click” launch instances” and go to instance view page.

Screen Shot 2017-04-27 at 9.05.51 PM.png8. When all the lights are green as shown above, select your instance and click “Connect” above. You can see another window here.

Screen Shot 2017-04-27 at 9.26.44 PM.png Copy the DNS of NO.4 of “To access your instance” and paste into your browser, add “:8787” at the end of the DNS address.

9. You will see the log in page of R server. Use the user name and password set already to log in and you can see the familiar r studio.Screen Shot 2017-04-27 at 9.34.34 PM.png

10. install h2o package and we can train our deep learning model.

Screen Shot 2017-04-27 at 9.04.50 PM.png

11. About the data to load.

There are two ways to load data for R studio running in instance of AWS EC2.

We can upload the data through the window at the right bottom in .zip(recommended).

Or we can use S3 service or AWS can store the data online and use the data with RCurl package with url.

Screen Shot 2017-04-27 at 9.04.56 PM.png


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s