This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-03
Channels
- # announcements (4)
- # aws (19)
- # babashka (55)
- # beginners (40)
- # biff (4)
- # calva (9)
- # cherry (3)
- # cider (8)
- # clj-kondo (26)
- # clj-yaml (3)
- # clojure (92)
- # clojure-austin (14)
- # clojure-europe (21)
- # clojure-nl (1)
- # clojure-norway (5)
- # clojure-portugal (3)
- # clojure-uk (2)
- # clojurescript (48)
- # conjure (19)
- # datalevin (14)
- # docker (13)
- # emacs (3)
- # fulcro (21)
- # gratitude (14)
- # improve-getting-started (1)
- # introduce-yourself (2)
- # joker (4)
- # juxt (2)
- # lsp (12)
- # malli (5)
- # meander (17)
- # off-topic (13)
- # re-frame (7)
- # scittle (2)
- # test-check (2)
Does the Cognitect AWS API offer anything interacting with the EC2 instance metadata? I can't find it in the docs, but other SDKs do. We want a Clojure process to be able to read the tags of the instance it's running on, which should be exposed via instance metadata
If you can tell me the name of the aws APi service that would respond with the ev2 metadata i can probably give you an example of getting it using the clojure api.
You can make a call to the metadata service and it responds with a json doc: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html
This is useful when you want to query the tags from a process running on the instance
A more flexible that works even if your process is not on the instance is to use describe instances and you get a ton of stuff
Since originally tags were not available in the metadata service, you previously had to get the instance Id and then use it with describe instances to get get the tags; now the tags are available, but not by default - they have to be enabled
Sorry I meant @U6SUWNB9N
Yeah, there isn't really an API in the way we were originally hoping, we meant using the IMDSv2 service that runs on AWS instances. A lot of other AWS SDKs include support for getting the information out of that in a more 'language standard' way, even though it's not explicitly an AWS API. It seems that neither the java v2 SDK nor the Cognitect Clojure SDK support it, so doing an instance metadata lookup externally is our best bet. We're using an ASG, and it seems to you can't turn the ability to read tags via instance metadata on through an ASG template, only through the launch template for an explicit instance, so :man-shrugging::skin-tone-2:
Well in that case you can use the regular describe instances to get the tags, the v1 version is simple as curl
to get you the instanceId
in some environments, (Fargate for example) metadata URL is even provided via standard environment variable - so you don't have to hardcode the standard url (I believe it can change under certain circumstances)
I found https://cljdoc.org/d/com.cognitect.aws/api/0.8.301/api/cognitect.aws.client.api, but that specifically says it's implementation-internal
Are there any plans to migrate aws-api internals to use Jetty 10 (or 11)? Right now it's pulling jetty-util 9.4, which conflicts with dependencies required by Jetty 10 (the webserver part)
aws-api uses the Cognitect http-client, which is where the jetty dependency comes from. There is no plan to upgrade the http-client to jetty 10, however we are working on supporting the java http-client in aws-api when you're running on java >= 11. I can't give you a solid timeline on that, but it is in progress work.
This looks even better to me than simply upgrading jetty!
When you do so, if it makes sense, please remember to document the impact of configuring with jetty vs 11's client, if you measured some.
@U0ENYLGTA nice, that sounds great, we're on java 11 and moving to 17 soon 👍
The feature we're introducing is more like "Bring Your Own Http Client" than "yay, java 11 client". When we roll it out, there will be a protocol that you can reify to wrap the client of your choice, with implementations for the Cognitect http-client and the java 11 client. Once that's out, you could also write your own wrapper for jetty 10 or 11, clj-http, etc, etc.
aws-api uses the Cognitect http-client, which is where the jetty dependency comes from. There is no plan to upgrade the http-client to jetty 10, however we are working on supporting the java http-client in aws-api when you're running on java >= 11. I can't give you a solid timeline on that, but it is in progress work.