aws

http://status.aws.amazon.com/ https://www.expeditedssl.com/aws-in-plain-english
Empperi 2020-05-25T18:40:52.248800Z

Hi. I have a problem with Amazonica and Localstack

Empperi 2020-05-25T18:41:29.249600Z

No matter what I do, I cannot get endpoint configuration into place in such a way that AWS SDK or Amazonica would like it

Empperi 2020-05-25T18:42:00.250Z

Any tips on how to do this?

Empperi 2020-05-25T18:42:52.250900Z

I've tried all the usual (s3/list-buckets {:endpoint "<http://localstack-url:1234>"}) stuff already

Empperi 2020-05-25T18:43:27.251300Z

All I get is

java.lang.IllegalStateException: S3 client with invalid S3 endpoint configured: my-localstack-domain:4566

Empperi 2020-05-25T18:44:05.251900Z

This happens at

com.amazonaws.services.s3.AmazonS3Client.getRegion(AmazonS3Client.java:4590)

Empperi 2020-05-25T18:44:44.252400Z

Which makes sense since Amazonica is leaving region as nil on purpose https://github.com/mcohen01/amazonica/blob/master/src/amazonica/core.clj#L162

Empperi 2020-05-25T18:48:43.253100Z

I however cannot create that EndpointConfiguration object myself and pass it in since Amazonica is expecting a string

Empperi 2020-05-25T19:22:02.253500Z

Managed to hack past that with this:

(with-redefs [amazonica.core/build-client (constantly
                                            (-&gt; (AmazonS3ClientBuilder/standard)
                                                (.enablePathStyleAccess)
                                                (.withEndpointConfiguration (AwsClientBuilder$EndpointConfiguration.
                                                                              (format "<http://%s:%s>" host port)
                                                                              "eu-central-1"))
                                                (.build)))]
  (s3/list-buckets))

Empperi 2020-05-25T19:22:19.253900Z

Definitely not pretty but at least now I get requests to localstack