This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-03
Channels
- # aws (27)
- # beginners (64)
- # boot (14)
- # calva (10)
- # cider (36)
- # cljs-dev (13)
- # cljsrn (79)
- # clojure (58)
- # clojure-berlin (8)
- # clojure-france (1)
- # clojure-italy (18)
- # clojure-nl (9)
- # clojure-russia (1)
- # clojure-spec (28)
- # clojure-uk (29)
- # clojurescript (55)
- # core-async (20)
- # cursive (5)
- # datomic (105)
- # emacs (17)
- # figwheel-main (13)
- # fulcro (20)
- # graphql (4)
- # hoplon (1)
- # hyperfiddle (2)
- # jobs (7)
- # jobs-discuss (110)
- # off-topic (23)
- # pathom (1)
- # perun (2)
- # re-frame (87)
- # reitit (2)
- # shadow-cljs (8)
- # spacemacs (2)
- # tools-deps (118)
- # vim (11)
hi! Does anyone know if there is a programmatic way to discover what AMI
s are available in the marketplace? e.g. the identifier of all deep learning AMI
s?
@aaelony https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeImages.html ?
@dottedmag that looks interesting. I will check it out. Thank-you
hmmm. not sure this is working well just yet, but something along these lines:
(defn find-AMIs
"Search the `Name` field for a matching string in all available AMIs."
;;
[regex-string]
(let [re (re-pattern (str ".*" regex-string ".*"))
ami-maps (:Images (aws/invoke ec2-client {:op :DescribeImages
:request {:Filters [{:Public true}]
;;:DryRun true
}}))
ami-names (->> ami-maps
(mapv :Name)
(filterv #(not (nil? %))))
ami-name-matches (->> ami-names
(filterv #(re-matches re)))
]
(vec ami-name-matches)
))
the idea is that you could then seek out deeplearning AMI’s with (find-AMIs “deeplearning”) or so
you can also use their filter syntax, this one filters on the Description field but you can do it with Name as well: aws ec2 describe-images --owners amazon --filters 'Name=description,Values=*deep learning*' 'Name=state,Values=available' --output json
- it should be easy enough to do something like that with the function you have there
I saw that but I didn’t have time to figure it out just yet. If you have a sense for it, please lmk
also, I believe the AMIs would need “deep*learning” since deeplearning strings are common
Something like: {:Filters [{:State "available"} {:Description (str "*" regex-string "*")}]}
this helps explain what you can do: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Filtering.html#Filtering_Resources_CLI
it's a case-sensitive search, so you might still need to fetch all of them and run them through a filter as you've done, just depends on your requirements
interesting. I ran one without the filter and one with the filter. Both return a count of 84214.
well feel free to ignore that suggestion if it doesn't work! I kind of want to know why now though, but there's nothing incorrect about the filter
solution certainly, unless you're worried about API limits or conservation of network resources
I think I must be missing it, but I don’t see Cloudwatch among the releases for the cognitect aws client api. https://github.com/cognitect-labs/aws-api/blob/master/latest-releases.edn
Something that would correspond to https://docs.aws.amazon.com/cli/latest/reference/cloudwatch/index.html or https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/cloudwatch/AmazonCloudWatchClient.html
Might be best to file a github issue so this doesn’t get lost - I don’t know off the top of my head
.@U0ENYLGTA followed up in the ticket: it’s in the monitoring
endpoint
@gws, I don’t doubt there is a way to make the filter part work in the request. I just haven’t found it yet and the clojure side filter does in fact work. At some point, I hope to be able to devote time to figuring out the request side filter but can’t at the moment (and the workaround suffices)