diff --git a/lib/AWS/EC2/instances.rb b/lib/AWS/EC2/instances.rb index 71f7653..caa2960 100644 --- a/lib/AWS/EC2/instances.rb +++ b/lib/AWS/EC2/instances.rb @@ -82,14 +82,20 @@ def run_instances( options = {} ) # instance is specified that does not exist a fault is returned. If an instance is specified that exists but is not # owned by the user making the request, then that instance will not be included in the returned results. # + # An optional filter can be provided to to request information for instances that corresponds this filter only + # # Recently terminated instances will be included in the returned results for a small interval subsequent to # their termination. This interval is typically of the order of one hour # # @option options [Array] :instance_id ([]) + # @option options [Hash] :filter ({}) # def describe_instances( options = {} ) - options = { :instance_id => [] }.merge(options) - params = pathlist("InstanceId", options[:instance_id]) + options = { :instance_id => [], :filter => {} }.merge(options) + params = {} + params.merge!(pathlist("InstanceId", options[:instance_id])) + params.merge!(pathhashlist("Filter", options[:filter].map{|k,v| {:name => k.is_a?(Symbol) ? k.to_s.gsub("_", "-") : k, :value => v}}, {:name => 'Name', :value => 'Value'})) + return response_generator(:action => "DescribeInstances", :params => params) end @@ -296,4 +302,3 @@ def self.local_instance_meta_data end end -