Cloud Server GPUs

Overview

Cloud server instances with GPUs are available from services like Amazon EC2 and Google Compute Engine. You can use RStudio Server on these instances, making the development experience nearly identical to working locally.

Amazon EC2

RStudio has AWS Marketplace offerings that are designed to provide stable, secure, and high performance execution environments for deep learning applications running on Amazon EC2. The tensorflow, tfestimators, and keras R packages (along with their pre-requisites, including the GPU version of TensorFlow) are installed as part of the image.

Launching the Server

There are AMIs on the Amazon Cloud Marketplace for both the open-source and Professional versions of RStudio Server. You can find them here:

You should launch these AMIs on the p2.xlarge instance type. This type includes a single GPU whereas other GPU-based images include up to 16 GPUs (however they are commensurately much more expensive). Note that you may need to select a different region than your default to be able to launch p2.xlarge instances (for example, selecting “US East (Ohio)” rather than “US East (N Virginia)”).

Accessing the Server

After you’ve launched the server you can access an instance of RStudio Server running on port 8787. For example:

Then, use the RStudio Terminal to change the default password using the passwd utility:

Your EC2 deep learning instance is now ready to use (the tensorflow, tfestimators, and keras R packages along with their pre-requisites, including the GPU version of TensorFlow, are installed as part of the image).

See the sections below for discussion of various ways in which you can make your EC2 instance more secure.

Limiting Inbound Traffic

The EC2 instance is by default configured to allow access to SSH and HTTP traffic from all IP addresses on the internet, whereas it would be more desirable to restrict this to IP addresses that you know you will access the server from (this can however be challenging if you plan on accessing the server from a variety of public networks).

You can see these settings in the Security Group of your EC2 instance:

Edit the Source for the SSH and HTTP protocols to limit access to specific blocks of IP addresses.

Using HTTPS

By default the EC2 instance which you launched is accessed over HTTP, a non-encrypted channel. This means that data transmitted to the instance (including your username and password) can potentially be compromised during transmission.

The details of adding HTTPS support to your server are beyond the scope of this article (see the links above to learn more). An alternative to this is to prohibit external HTTP connections entirely and access the server over an SSH Tunnel, this option is covered in the next section.

SSH Tunnel

Using an SSH Tunnel to access your EC2 instance provides a number of benefits, including:

Use of the SSH authentication protocol to identify and authorize remote users

Encrypting traffic that would otherwise be sent in the clear

Note that SSH tunnel access as described below works only for Linux and OS X clients.

Security Group

To use an SSH Tunnel with your EC2 instance, first configure the Security Group of your instance to only accept SSH traffic (removing any HTTP entry that existed previously):

Note that you may also want to restrict the Source of SSH traffic to the specific block of IP addresses you plan to access the server from.

Server Configuration

Next, connect to your instance over SSH (click the Connect button in the EC2 console for instructions specific to your server):