Git Product home page Git Product logo

vagrant-ec2's Introduction

Vagrant-EC2

Deprecated

Everything these scripts do is done much better by the vagrant-aws plugin (which happens to be written by Vagrant's author).

This repository shows how to use the same chef-solo-based provisioning scheme for Vagrant virtual machines and Amazon's EC2. This is useful because you'll be able to test the deployment procedures as you develop within a clean Vagrant machine. Running continuous deployment locally also saves tons of partial instance-hours, which can run into the hundreds of cents (I'm not made of money, people).

These scripts have been tested only on Ubuntu Linux.

Development (local)

Just use Vagrant as you normally would:

cd a_vagrant_machine/
vagrant up
vagrant ssh

Production (EC2)

Start up a new EC2 instance (ami-af7e2eea is a US west coast Ubuntu 10.10 64-bit server)

ec2-run-instances ami-af7e2eea                 \
  --instance-type t1.micro                     \
  --key yournamehere                           \
  --user-data-file bootstrap.sh

find its IP with

ec2-describe-instances

and provision it using the same recipes as the demo Vagrant machine machine by running

./setup.sh <ip address> a_vagrant_machine/

DONE!

Don't forget to turn off your instances when you're finished:

ec2-terminate-instances <i-instance_id>

Converting existing Vagrantfiles

Just add three lines in the provisioning section of your Vagrantfile so it looks like this: Note: fixed problem (tar command does not have --transform option) on MacOS X

config.vm.provision :chef_solo do |chef|

  <your provisioning here>

  require 'json'
  open('dna.json', 'w') do |f|
    chef.json[:run_list] = chef.run_list
    f.write chef.json.to_json
  end
    open('.cookbooks_path.json', 'w') do |f|
    f.puts JSON.generate([chef.cookbooks_path]
                           .flatten
                           .map{|x| x})
  end
end

Setup local machine

On your local machine, you will need the following

  • ec2-api-tools Ubuntu multiverse package (this is not currently in Debian's apt repositories; you'll need to download the Ubuntu .deb package and use dpkg --install)
  • VirtualBox 4
  • Vagrant rubygem; gem install vagrant
  • The lucid32 Vagrant base box; vagrant box add lucid32 http://files.vagrantup.com/lucid32.box. Take a look at the vagrant-ubuntu repository for scripts to make custom Ubuntu-based Vagrant base boxes.

Add to your .bashrc

EC2_PRIVATE_KEY=/path/to/pk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.pem
EC2_CERT=/path/to/cert-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.pem
EC2_SSH_PRIVATE_KEY=/path/to/pk-yournamehere.pem
JAVA_HOME=/usr/lib/jvm/java-6-sun/
EC2_URL=https://ec2.us-west-1.amazonaws.com

Thanks

This project is sponsored by Keming Labs, a technical design studio specializing in data visualization.

vagrant-ec2's People

Contributors

lynaghk avatar sbecker avatar simianarmy avatar ryuzee avatar

Stargazers

曹文忠 avatar mohammad avatar Omar avatar Angus H. avatar  avatar Ian Channing avatar Pawel Cyrta avatar Sylvain MAUDUIT avatar Dustin O'Brien avatar Satoshi Ohmori avatar JT5D avatar Bob TheBuilder avatar JW avatar Liqiu Huang avatar Malcom Gilbert avatar Jarrod Parker avatar Adam Buran avatar Kostya Golikov avatar Eric Reeves avatar Zhiping Yang avatar gregory nicholas avatar kazuya kawaguchi avatar Keiji Matsuzaki avatar Eugene Marinelli avatar Takuya Mannami avatar Chris Bennett avatar  avatar Roberto Aloi avatar  avatar wolfg avatar  avatar Jonathan Urzua avatar Brian Scott avatar  avatar Zack Zondlo avatar Derek Myers avatar  avatar Yonggao Pan avatar [Gone] avatar Nathan Fixler avatar Christian Roman avatar Simon Swain avatar  avatar Eric Reeves avatar Tyler Cloke avatar  avatar Jon Morehouse avatar Mohit Sethi avatar fang duan avatar Stephan Miller avatar Howard Mei avatar Yitzchok Willroth avatar Brian Sulcer avatar Jacob Gabriel avatar  avatar Denis Nemtsev avatar Esen Sagynov avatar Emil Stenqvist avatar Mark Cheverton avatar Heesang Chae avatar mattimatti avatar Himanshu Gilani avatar Dave Harrington avatar Michael Solovyov avatar jerius avatar Hank Bao avatar Guo Fei avatar  avatar Kip DeGraaf avatar Ben Evans avatar Jonathan Lomas avatar Alwin Schoemaker avatar Adrien Brault avatar Govinda Fichtner avatar Claudia Doppioslash avatar Cameron Woodmansee avatar Mike Bohlander avatar  avatar River MacLeod avatar Markle avatar Gardiner Allen avatar Cameron Smith avatar Alan Zimmerman avatar Andy Lindeman avatar Michael Hood avatar  avatar Sam Vafaee avatar Patrick Connolly avatar velniukas avatar  avatar Augustine Tran avatar John Schnare avatar Michael Klein avatar  avatar  avatar Stanislaw Pusep avatar Karl Herler avatar Seth Sandler avatar gongbin avatar Ethan Sherbondy avatar

Watchers

John Dyer avatar Henry Huang avatar  avatar Roberto Aloi avatar Mike Gifford avatar  avatar Stanislaw Pusep avatar Xinjiang Lu avatar Nicolas avatar Steve Baker avatar James Cloos avatar Stephan Miller avatar  avatar

vagrant-ec2's Issues

Support roles?

Hey!

Love the work you did on this.

I got the script to work on Amazon but I had to comment out:

chef.add_role("drupal_lamp_varnish_dev")

As I was getting:

./ec2_package.rb:29: I can't find any cookbooks called 'roledrupal_lamp_varnish_dev' (RuntimeError)
    from ./ec2_package.rb:21:in `map'
    from ./ec2_package.rb:21
    from ./ec2_package.rb:20:in `open'
    from ./ec2_package.rb:20
    from ./ec2_package.rb:7:in `chdir'
    from ./ec2_package.rb:7

Would you be aware what I would need to do to have roles being passed in as well? Possibly convert them to json format instead of dsl? Or I guess a small rewrite of ec2_package.rb?

VagrantFile

So in the Readme in the section - Converting existing Vagrantfiles

Are the 3 lines basically everything under ?

I'm not sure what this does or how it should relate to the VagrantFile I'm using, but since I'm still quite new to this, your example doesn't give me quite enough context to make sense of it.

Anyways, I'm just trying to move a Chef install from VirtualBox to the cloud (and ultimately a dedicated server) and am running into a lot of code but almost no documentation.

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.