public
Description: A set of extra command line tools for Amazon EC2
Homepage: http://blog.carlmercier.com
Clone URL: git://github.com/cmer/ec2-extra-tools.git
ehaselwanter (author)
Thu Mar 05 10:13:45 -0800 2009
cmer (committer)
Thu Mar 05 15:51:21 -0800 2009
ec2-extra-tools / ec2-identify-volume
100755 14 lines (10 sloc) 0.35 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/ruby
 
# Returns the EBS volume id of a device. eg: /dev/sdj
 
if ARGV[0].nil?
  puts "You must specify the device. eg: ec2-identify-volume /dev/sdj"
  exit 1
end
 
instance_id = `ec2-identify-instance`
device = ARGV[0].strip.downcase
volume_id = `ec2-describe-volumes | grep #{instance_id} | grep #{device}`.split("\t")[1]
print volume_id