Giter VIP home page Giter VIP logo

ec2-run's Introduction

This simple script lets you launch a cluster of EC2 instances on AWS, upload a different script to each instance, run those scripts in parallel, download their results in the end of the run and finally tear down the cluster.

This script depends on Boto for AWS API. Install Boto via

pip install boto

Before You Start

  • Create a key pair for yourself on AWS.
  • Set the environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to your Amazon EC2 access key ID and secret access key. These can be obtained from the AWS homepage by following Account > Security Credentials > Access Credentials.

Launching a Cluster

  • Typical usage: python ec2_run.py -k <key-pair-name> -i <private-key> -n <num-instnaces> -a <AMI-ID> -r <region> --spot-price=<upper-limit-for-spot-request-in-USD> -u <user-name> -t <instance-type> -s <local-path-to-the-directory-containing-scripts-to-run> -d <remote-path-under-which-the-script-will-be-uploaded> -c <command-to-run-on-each-instance> -o <path-to-the-output-file-on-each-instance> -l <local-path-to-contain-the-downloaded-results> start <cluster-name> This command launches a cluster named , uploads the scripts, one to each instance, run the command, download the results and finally tear down the cluster.
  • Run script on an existing cluster: If you already have a cluster named running, you can upload scripts to it to run. Note that this will not terminate your cluster in the end! Example: python ec2_run.py -k <key-pair-name> -i <private-key> -s <local-path-to-the-directory-containing-scripts-to-run> -d <remote-path-under-which-the-script-will-be-uploaded> -c <command-to-run-on-each-instance> -o <path-to-the-output-file-on-each-instance> -l <local-path-to-contain-the-downloaded-results> run <cluster-name>
  • Terminate a cluster: python ec2_run.py -k <key-pair-name> -i <private-key> stop <cluster-name>
  • An example: python ec2_run.py -k <key-pair-name> -i <private-key> -n <num-instnaces> -a <AMI-ID> -r <region> --spot-price=<upper-limit-for-spot-request-in-USD> -u <user-name> -t <instance-type> -s /Users/awesomeyou/ec2-run.git/test_scripts/ -d /home/ubuntu -c "python /home/ubuntu/%s /home/ubuntu/testout" -o /home/ubuntu/testout -l /Users/jinliangwei/Work/ec2-run.git/test_scripts.out/ start <cluster-name>

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.