Created
March 4, 2011 02:03
-
-
Save dcampano/854040 to your computer and use it in GitHub Desktop.
quick way to mount a bunch of disks to an ec2 instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'fog' | |
connection = Fog::Compute.new(:provider => "AWS", :region => "us-west-1") | |
current_instance_id = `curl http://169.254.169.254/latest/meta-data/instance-id` | |
current_instance = connection.servers.get(current_instance_id) | |
letters = 'f'..'l' | |
letters.to_a.each do |letter| | |
current_disk = "/dev/sd#{letter}" | |
vol = connection.volumes.new(:availability_zone => current_instance.availability_zone, :size => 75) | |
vol.device = current_disk | |
vol.server = current_instance | |
vol.save | |
p vol | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment