Get the name ec2 dns via the pallet

I am returning a list of ec2 nodes using a pallet. I want to get the names of these DNS. I see that dnsName exists in jclouds, but I don’t see access to it for use with a pallet in clojure. Is it possible?

More details

I am trying to make changes to a storm deployment project to work with DNS names so that security groups work correctly. In particular, I'm trying to write something like this function for use in code:

(defn zookeeper-dns-names [compute name] (let [running-nodes (filter running? (map (partial jclouds-node->node compute) (nodes-in-group compute (str "zookeeper-" name))))] (map dns-name running-nodes))) 
+4
source share
1 answer

I use this in our pallet builder, which gets the dns name via public ip:

 (defn get-aws-name [] (let [ip (-> (target-node) bean :publicAddresses first)] (str "ec2-" (apply str (replace {\. \-} ip)) ".compute-1.amazonaws.com"))) 

Private IPs also work through security groups:

 (defn ips-in-group [group-name public-or-private] "Sequence of the first public IP from each node in the group" (->> (nodes-in-group group-name) (map bean) (map public-or-private) (map first)) (defn public-ips-in-group "Sequence of the first public IP from each node in the group" [group-name] (ips-in-group group-name :publicAddresses)) (defn private-ips-in-group "Sequence of the first public IP from each node in the group" [group-name] (ips-in-group group-name :privateAddresses)) 
+1
source

Source: https://habr.com/ru/post/1480128/


All Articles