Skip to content

Instantly share code, notes, and snippets.

@bhouse
Created Sep 9, 2015
Embed
What would you like to do?
#!/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