Skip to content

Instantly share code, notes, and snippets.

@mjul
Created August 24, 2012 23:13
Show Gist options
  • Save mjul/3456996 to your computer and use it in GitHub Desktop.
Save mjul/3456996 to your computer and use it in GitHub Desktop.
Start and stop an Amazon EC2 server in EU region from Pallet
(defn start [config]
(pallet.core/converge
(pallet.core/group-spec "mygroup"
:count 1
:node-spec (pallet.core/node-spec
:image {:os-family :ubuntu}
:location {:location-id "eu-west-1"})) ;; :location-id is the name of the AWS Region
:compute config))
(defn stop [config]
(pallet.core/converge
(pallet.core/group-spec "mygroup" :count 0)
:compute config))
;; Let's try it out....
;; You can get your Access Key credentials in the AWS web site under "My Account".
(def cfg (pallet.configure/compute-service "aws-ec2"
:identity "____INSERT_YOUR_KEY____"
:credential "____INSERT_YOUR_SECRET_KEY___"))
(start cfg)
(stop cfg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment