Launch an existing EC2 instance using Clojure and Pallet
I have a few EC2 instances on AWS that are in a suspended state. I'd like to use pallet to start them up from a Clojure program (and ultimately put them back into suspend). I'm not finding how to do this anywhere in the docs or examples. I've been able to connect to my AWS service and get a list of instances (as a list of nodes) using
(def awsse开发者_如何学Pythonrvice (compute-service "aws-ec2" :identity "" :credential ""))
(def nodelist (nodes awsservice))
Now how do I start up one of these existing nodes? By trial and error I figured out that
(id (nth nodelist 0))
gives me an id of some sort for the first instance in the list, but I can't find how to start that instance up.
Pallet doesn't yet have nice access to the jclouds functions for this, but you should be able to access them like this:
(.resumeNode (.compute awsservice) (id (first nodelist)))
(.suspendNode (.compute awsservice) (id (first nodelist)))
精彩评论