     [trammel.core :refer (defconstrainedrecord)] 
     [celestial.provider :refer (wait-for wait-for-ssh)] 
     [celestial.core :refer (Vm)] 
-    [celestial.common :refer (import-logging )] 
+    [celestial.common :refer (import-logging)] 
     [celestial.persistency.systems :as s]
     [celestial.model :refer (translate vconstruct)]))
 


(def defaults {:aws {:min-count 1 :max-count 1}})

(defn aws-spec 
  "creates an ec2 spec" 
  [{:keys [aws machine] :as spec}]
  (merge-with merge (dissoc-in* spec [:aws :endpoint]) defaults))

(defmethod translate :aws [{:keys [aws machine] :as spec}] 
  [(aws :endpoint) (aws-spec spec) (or (machine :user) "root")])

   {:pre [(creation-keys aws)]}
   (let [inst (merge (dissoc aws :volumes) {:image-id (image-id machine)})
         {:keys [reservation]} (with-ctx ec2/run-instances inst)]
     (get-in reservation [:instances 0 :instance-id])))

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