Fork me on GitHub
#aws
<
2016-01-05
>
curtosis00:01:24

excellent! looks like it will fit the bill nicely! Otherwise I was slowly leaning towards writing a couple Lambda functions in python.

curtosis00:01:33

oh.. .hm... it doesn’t look like eulalie handles S3 yet. Might be possible to tack on.

curtosis00:01:43

my plan is cljs on the browser that generates a chunk of edn and dumps it into S3. Going thru API Gateway and a Lambda seems like it avoids the ugly S3 signed policy stuff.

curtosis00:01:00

(and I still can't find any docs or examples on putting file contents instead of a file name into the S3 POST.)

peterromfeld05:01:19

hi, anyone could get .createClient working with java-interop? every lib i’ve found so far they using .setRegion after the client got created i tried so far:

(def creds (BasicAWSCredentials. aws-access-key-id aws-secret-access-key))
(def region (-> "AP_SOUTHEAST_1" Regions/valueOf Region/getRegion))
(def cfn (.createClient region AmazonCloudFormationClient. creds))
and some trial and error with different versions of passing AmazonCloudFormationClient/class

alandipert05:01:52

looks like maybe you can do (.. (AmazonCloudFormationClient. creds) (withRegion (Regions/fromName "AP_SOUTHEAST_1")))

alandipert05:01:14

the .. is a good match for the withX "fluent" stuff all over amazon sdks

peterromfeld05:01:31

cool thanks, good to know

peterromfeld05:01:08

also clojures immutable data structures are also applied to java objects created via java interop in clojure? so the race condition documented about .setRegion afterwards shouldnt be a problem when running from clojure?

alandipert05:01:33

that's not what i undertsand

alandipert05:01:40

seems more to be advice not to setRegion on an existing client

alandipert05:01:51

instead creating a new client for that region

alandipert05:01:30

so they're saying, don't create the client and start doing work with it, and then set the region

peterromfeld05:01:44

ah ok thanks for clarification 😉

peterromfeld05:01:27

i somehow missed the last part of the sentence :/ before any service requests are made

alandipert05:01:56

so many reams of docs with AWS it's easy to miss things 📚

peterromfeld05:01:22

out of curiosity how would this translate to clojure interop?

AmazonEC2 ec2 = Region.getRegion(Regions.US_WEST_2).createClient(
  AmazonEC2Client.class, credentials, clientConfig);
the AmazonEC2Client.class is kind irritating (i have 0 java background)

alandipert05:01:29

(import
 com.amazonaws.regions.Region
 com.amazonaws.regions.Regions
 com.amazonaws.services.ec2.AmazonEC2Client)

(.createClient (Region/getRegion Regions/US_WEST_2) AmazonEC2Client credentials clientConfig)

alandipert05:01:15

wherever you see .class in Java you can just use the class name symbol in clj

alandipert05:01:30

in clj symbols that resolve to known classes resolve to the class value

alandipert05:01:40

e.g. AmazonEC2Client.class == AmazonEC2Client in clj

alandipert05:01:14

also in that code i'm using / both to call a static method getRegion and to get a static field US_WEST_2

alandipert05:01:44

.createClient is an instance method call to the object returned by (Region/getRegion ...)

peterromfeld05:01:42

got it, thanks!!

alandipert05:01:24

cheers - i'm off, see you later