aws

Benjamin 2022-07-18T16:18:55.690839Z

Does anybody have experience with redshift and sorting the data correctly, so queries stay fast? General RDB advice is welcome

Drew Verlee 2022-07-18T22:16:38.718379Z

advice specific to redshift or in general? In general the only way something can traverse something fast is if it's close together. As in, you have to store things in the sorted order. In database speak, that's indexing. space for time.

👍 1
Drew Verlee 2022-07-18T22:17:39.319539Z

In cloudformation, when your spinning up resources, if one requires the ARN of another how do you handle that? like, how do they do references?

Drew Verlee 2022-07-18T22:19:49.549049Z

lol. thanks @jjttjj

Drew Verlee 2022-07-18T22:20:47.183799Z

i'll figure it out from here i'm sure, but this example is funny because it has a ref but not the important bit where it shows the other end of the edge.

MyEIP:
  Type: "AWS::EC2::EIP"
  Properties:
    InstanceId: !Ref MyEC2Instance # <--- where is this declared?

2022-07-18T22:20:55.544459Z

Depending on the resource type, it may or may not return what you need for the other resource parameter. Sometimes you'll need to use Fn::GetAtt instead. I find i consult this a lot https://theburningmonk.com/cloudformation-ref-and-getatt-cheatsheet/

2022-07-18T22:22:04.454409Z

The Ref argument refers to either the name you give the resource (ie, names on the level of MyEIP in that example, MyEC2Instance would be a sibling ), or the name of a parameter of your template. (and maybe some more stuff I'm forgetting)

Drew Verlee 2022-07-18T22:23:34.175509Z

This is how cloudformation makes me feel on the inside.

😆 1
2022-07-18T22:24:24.952539Z

Haha yup it definitely feels like coding in json a bit, wait til you get to if statements/conditionals

2022-07-18T22:28:04.986549Z

I've been on an ongoing deep dive in to cloudformation. Overall I like it, after getting comfortable with the ways to do things. In the end I like that it's just JSON and it's nice that you can just stick some edn in a clojure file and break it up and add as many helpers as you want before calling some json library to write it out as json.

Drew Verlee 2022-07-18T22:33:40.180449Z

I'm certainly glad it's an option! I wonder if there are any clojure wrappers that do some really fun runtime analysis to try and help you intelligent build and update cloudformation though. You could pull the api and return suggestions in the editor. etc... I know you can output CF from the design tool, but it doesn't seem to actually help you with anything other then putting pictures together. which is odd... Is "taskdefination" the name of the instance of this task below?

taskdefinition: 
  Type: AWS::ECS::TaskDefinition

2022-07-18T22:34:35.512179Z

yes

2022-07-18T22:36:02.971949Z

{:Resources {"<your names>" {:Type "" :Properties {...}} ...}

2022-07-18T22:40:23.539559Z

There are a few attempts at tooling in clojure ie https://github.com/brabster/crucible, but I don' think it has that many resource types supported and isn't actively being updated

2022-07-18T22:41:08.789959Z

the specification for everything is here though so it shouldn't be too hard to get an auto-complete thing going https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html

Drew Verlee 2022-07-18T22:42:43.839599Z

interesting, ill have to take a look. If for no other reason then it will probably help me conceptualize whats going on.

seepel 2022-07-18T03:11:28.209329Z

Hi there, I'm trying to use the java aws sdk to initialize a SecretsManagerClient following along with examples I found online this is the code I expect to work

(-> (SecretsManagerClient/builder)
                   (.region (Region/of "us-west-2"))
                   .build)
But I get the following error
Execution error (IllegalArgumentException) at user/eval18745 (form-init12695352935497667069.clj:1).
No matching method of found taking 1 args for class java.lang.Class
However, if I import the class at the repl, calling
(Region/of "us-west-2")
does indeed work correctly. Does anyone have experience with something like this? EDIT: here is another more clear error message that I also got:
No matching method of found taking 1 args for class com.amazonaws.regions.Region

2022-07-18T03:20:46.008839Z

My guess is when you "import the class at the repl" you are importing a different class

seepel 2022-07-18T03:26:02.919489Z

Ohhhh, indeed. In my code it is imported as

(com.amazon.regions Region)
Whereas at the repl I imported
(software.amazon.awssdk.regions Region)
The latter doesn't work in my namespace though... Even though I guess I don't really understand what is going on, I think I did sort out that I can get the region like this...
(-> (SecretsManagerClient/builder)
                   (.region (Region/getRegion Regions/US_WEST_2))
                   .build)
Thank you for the tip @hiredman!

seepel 2022-07-18T03:28:34.760269Z

Oh gosh, maybe not.

class com.amazonaws.regions.Region cannot be cast to class software.amazon.awssdk.regions.Region (com.amazonaws.regions.Region and software.amazon.awssdk.regions.Region are in unnamed module of loader 'app')

seepel 2022-07-18T03:31:55.046449Z

I must've had a typo, I just deleted everything and very carefully added it back in. Thank you for the duckie