Skip to content

Instantly share code, notes, and snippets.

@bhouse
Created September 9, 2015 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhouse/4cd8dd7b625a345a64b6 to your computer and use it in GitHub Desktop.
Save bhouse/4cd8dd7b625a345a64b6 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'aws-sdk'
ec2 = Aws::EC2::Client.new(region: 'us-west-1')
volumes = ec2.describe_volumes.volumes
volume_sizes = {}
volumes.each do |vol|
volume_sizes[vol.volume_type] ||= []
volume_sizes[vol.volume_type] << vol.size
end
volume_sizes.each do |type, sizes|
puts format('%s: %d', type, sizes.reduce(:+))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment