Deploy on Amazon EC2
Felix Abecassis edited this page Nov 14, 2017
·
17 revisions
Pages 25
- Home
- About version 2.0
- Advanced topics
- CUDA
- Deploy on Amazon EC2
- Deploy on Azure
- DIGITS
- Docker Hub
- Frequently Asked Questions
- GPU isolation (version 1.0)
- Image inspection (version 1.0)
- Installation (version 1.0)
- Installation (version 2.0)
- Internals
- List of available images
- Motivation
- NGC
- NVIDIA Caffe
- nvidia docker
- nvidia docker plugin
- NVIDIA driver (version 1.0)
- Third party
- Troubleshooting
- Usage
- What is Docker?
- Show 10 more pages…
Introduction
Version 2.0
Version 1.0 (Deprecated)
Container images
Tutorials
Clone this wiki locally
This page hasn't been updated for 2.0 yet
Contents
Amazon AWS account setup
Connect to your AWS management console
Step 1
Under VPC > Subnets
- Select your VPC ID
- Select the corresponding Availability Zone

Step 2
Under Identity and Access Management > Users
- Create a new user
- Save the newly generated pair Access Key / Secret Access Key
- Edit the user permissions and give it the policy AmazonEC2FullAccess


GPU instance creation
Before deploying GPU containers, we first need to provision an EC2 P2 instance.
Using Docker machine and the information above:
docker-machine create --driver amazonec2 \
--amazonec2-region us-west-2 \
--amazonec2-zone b \
--amazonec2-ami ami-efd0428f \
--amazonec2-instance-type p2.xlarge \
--amazonec2-vpc-id vpc-*** \
--amazonec2-access-key AKI*** \
--amazonec2-secret-key *** \
aws01Once the provisioning is completed, we install the NVIDIA drivers and NVIDIA Docker on the newly created instance (using a Ubuntu 16.04 AMI).
Note that if you create a custom AMI, you could simply reuse it instead of doing what follows:
# Restart the instance first, to be sure we are running the latest installed kernel
docker-machine restart aws01
# SSH into the machine
docker-machine ssh aws01
# Install official NVIDIA driver package
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
sudo sh -c 'echo "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 /" > /etc/apt/sources.list.d/cuda.list'
sudo apt-get update && sudo apt-get install -y --no-install-recommends linux-headers-generic dkms cuda-drivers
# Install nvidia-docker and nvidia-docker-plugin
wget -P /tmp https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.1/nvidia-docker_1.0.1-1_amd64.deb
sudo dpkg -i /tmp/nvidia-docker*.deb && rm /tmp/nvidia-docker*.deb
exit
# Reboot to complete installation of the NVIDIA driver
docker-machine restart aws01Container deployment
First, setup your environment:
eval `docker-machine env aws01`
export NV_HOST="ssh://ubuntu@$(docker-machine ip aws01):"
ssh-add ~/.docker/machine/machines/aws01/id_rsaUsing nvidia-docker remotely you can now deploy your containers in the Amazon cloud:
$ nvidia-docker run --rm nvidia/cuda nvidia-smi
Wed May 17 17:13:09 2017
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 375.51 Driver Version: 375.51 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Tesla K80 Off | 0000:00:1E.0 Off | 0 |
| N/A 26C P8 29W / 149W | 0MiB / 11439MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+