   (let [t (stop-instances :instance-ids is)]
     (debug t)
     t))
+
+(defn start [is]
+  (let [t (start-instances :instance-ids is)]
+    (debug t)
+    t))
+
 
 (defn cancel-requests [rs]
   (let [ds (:spot-instance-requests (describe-spot-instance-requests :spot-instance-request-ids rs))

  (str
   "aws --region " (or region my-region)
   " sns publish --topic-arn " (or topic my-sns-topic)
   " --message `(echo \"id: " id "\";bin/ec2-metadata -i -p -o) | base64 -w 0`"))

;(stop-instances :instance-ids ["i-7c949193"])
;(modify-instance-attribute :instance-id "i-7c949193" :user-data (s->b64 "echo hello"))


(defn bring-up-spots  [reqmap nmin cmds & opts]
  (let [cmd (str (send-up) "\n "(clojure.string/join "\n" cmds))
        req (apply ph-assoc reqmap paths opts)
        req (ph-assoc req paths :udata cmd)
        ;req (assoc req :nmin nmin)
        n   (ph-get reqmap paths :n)
        req (if (<= nmin n) req (ph-assoc req paths :n nmin))
        id  (.toString (UUID/randomUUID))
        _   (debug "Requesting:" id req)
        cl  (notify-chan id)
        rs  (request-spots req)

          (>! c req) (close! c)))
    c))



