          (debug "clearing dynamic ip from system")
          (s/update-system (spec :system-id) 
            (dissoc-in* (s/get-system (spec :system-id)) [:machine :ip])))
-       (with-ctx ec2/stop-instances instance-id) 
+       (with-ctx ec2/stop-instances {:instance-ids instance-id}) 
        (wait-for-status this "stopped" [5 :minute])))
 
   (status [this] 

    (do ~@body) 
    (throw+ {:type ::aws:missing-id :message "Instance id not found"}))) 

(defn create-instance 
   "creates instance from aws" 
   [{:keys [aws machine] :as spec} endpoint]
   {:pre [(clojure.set/subset? (into #{} (keys aws))
       #{:volumes :min-count :max-count :instance-type :key-name})]}
   (let [inst (merge (dissoc aws :volumes) {:image-id (image-id machine)})]
     (-> (with-ctx ec2/run-instances inst) :instances first :id)))

(defconstrainedrecord Instance [endpoint spec user]
  "An Ec2 instance"


(ns aws.provider
  (:require 
    [amazonica.aws.ec2 :as ec2]
    [aws.common :refer (with-ctx instance-desc creds image-id)]
    [aws.networking :refer (update-ip set-hostname pub-dns)]
    [aws.volumes :refer (delete-volumes handle-volumes)]
    [aws.sdk.eip :as eip]
    [aws.validations :refer (provider-validation)]
    [celestial.persistency :as p]
