# File lib/deltacloud/drivers/ec2/ec2_driver.rb, line 171
        def instances(credentials, opts={})
          ec2 = new_client(credentials)
          inst_arr = []
          safely do
            inst_arr = ec2.describe_instances.collect do |instance| 
              convert_instance(instance) if instance
            end.flatten
            if tagging?
              tags = ec2.describe_tags('Filter.1.Name' => 'resource-type',
                                       'Filter.1.Value' => 'instance')
              inst_arr.each do |inst|
                name_tag = tags.select do |t|
                  (t[:aws_resource_id] == inst.id) and t[:aws_key] == 'name'
                end
                unless name_tag.empty?
                  inst.name = name_tag.first[:aws_value]
                end
              end
              delete_unused_tags(credentials, inst_arr.collect {|inst| inst.id})
            end
          end
          inst_arr = filter_on( inst_arr, :id, opts )
          filter_on( inst_arr, :state, opts )
        end