   (apply ->Instance (translate spec)))
 
 (comment 
-  (use 'celestial.fixtures)
-  (def m (vconstruct celestial.fixtures/puppet-ami)) 
-  (:endpoint m )
-  (.status m)
+  (use 'celestial.fixtures.data 'celestial.fixtures.core )
+  (def m (vconstruct redis-ec2-spec)) 
+  (with-admin (with-conf local-conf (.status m)))
+  (with-conf local-conf (with-admin (.create m)))
   (.start m)
-
   (clojure.pprint/pprint 
     (celestial.model/set-env :dev 
      (first (:addresses (eip/describe-eip (assoc (creds) :endpoint "ec2.eu-west-1.amazonaws.com") "i-cdd59781"))))) 

    (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]
