    [shuppet.aws :refer [ec2-request]]
    [shuppet.util :refer :all]
    [clojure.tools.logging :as log]
-   [clojure.data.zip.xml :refer [xml1-> text xml->]]))
+   [clojure.data.zip.xml :refer [xml1-> text xml->]]
+   [slingshot.slingshot :refer [try+ throw+]]))
 
 (defn- create-params [opts]
   (without-nils {"GroupName" (:GroupName opts)

  (let [egress (check-default-egress opts)]
    (when-not (empty? egress)
      (network-action sg-id egress :AuthorizeSecurityGroupEgress)
      (network-action sg-id {:IpRanges "0.0.0.0/0" :IpProtocol "-1"} :RevokeSecurityGroupEgress))))

(defn- network-config
  [params]


(defn- build-sg
  [opts]
  (delete-sg (:GroupName opts))
  (if-let [sg-id (create opts)]
    (try+
     (do
       (configure-network sg-id opts)
       (log/info "Succesfully created and configured a security group with the config " opts))
     (catch map? error
       (delete-sg (:GroupName opts))
       (throw+ error)))
    (log/error "Security group already exists for the config " opts)))

(defn- filter-params
