Git Product home page Git Product logo

aws-terraform-deep-learning's Introduction

AWS Deep Learning AMI with Terraform

Get a beefy GPU in AWS quickly.

Why you're here

Because you want to train some deep learning models and you need an instance in AWS with a powerful GPU (possibly with a Jupyter Notebook). However, you don't want the frustration of setting up security groups, VPCs, routing tables, subnets, installing libraries, etc. This setup should be as automated as possible so scientists and engineers can get working on models quickly. Using Terraform, I'm trying to get this setup as automated as possible. This module will spin up a p3.2xlarge in EC2 on the Deep Learning AMI.

Setup

WARNING: Never, ever copy any AWS credentials into source-controlled repositories. Someone will steal then and mine a bunch of Bitcoin on your dime!

  1. Download Terraform.
  2. Obtain an AWS key and secret and place in ~/.aws/credentials under the [terraform] profile. Make sure the account has permissions for EC2, EBS, etc.
    [terraform]
    aws_access_key_id = <your_key_id>
    aws_secret_access_key = <your_access_key>
    
  3. Create an SSH key pair with ssh-keygen and add the private key with ssh-add.
    ssh-keygen -t rsa -C "[email protected]" -f ~/.ssh/example_name
    ssh-add ~/.ssh/example_name
  4. Go into the terraform directory and run terraform init and terraform apply. You will be prompted to provide the location of your newly generated public SSH key (you can put this in a terraform.tfvars instead).
  5. When the command is done, assuming you have the correct permissions and such, you should see some output like the public IP addr and DNS name for the newly created instance.
  6. Get the address and try logging in via SSH ssh ubuntu@your-elastic-ip
  7. Mount the EBS Volume with these instructions. Keep in mind the device location in /dev will probably be different than in that tutorial.
  8. Copy the files to the instance.
  9. Activate the Conda environment you want. For example, if you want TensorFlow on Python 3.6: . ~/anaconda3/bin/activate tensorflow_p36
  10. Run Jupyter jupyter notebook --ip=* --no-browser. Get the token.
  11. Visit your browser at your-elastic-ip:8888/?token=<your-token-here>.

Contribute!

There are surely some improvements to be made. More to be automated, better security, better documentation. If you're feeling generous, please leave a PR with improvements or at least as issue with some helpful advice.

aws-terraform-deep-learning's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.