def kill_instances(instances)
      running_instances = instances.compact.select do |instance|
        instance_by_id(instance.instance_id).state.name == 'running'
      end
      instance_ids = running_instances.map(&:instance_id)

      return nil if instance_ids.empty?

      @logger.notify("aws-sdk: killing EC2 instance(s) #{instance_ids.join(', ')}")
      client.terminate_instances(:instance_ids => instance_ids)

      nil
    end
def kill_instances(instances)
      running_instances = instances.compact.select do |instance|
        instance_by_id(instance.instance_id).state.name == 'running'
      end
      instance_ids = running_instances.map(&:instance_id)

      return nil if instance_ids.empty?

      @logger.notify("aws-sdk: killing EC2 instance(s) #{instance_ids.join(', ')}")
      client.terminate_instances(:instance_ids => instance_ids)

      nil
    end
Kill all instances.

 @param instances [Enumerable<Aws::EC2::Types::Instance>]
 @return [void]