Is cognitect.aws.client
supposed to work with other S3 providers than amazon? I’m trying to connect to a NetApp StorageGRID S3 endpoint but don’t know how.
(aws/client {:api :s3
:endpoint-override {:hostname "<http://s3.example.com|s3.example.com>"}})
gives me an error:
Execution error (ExceptionInfo) at cognitect.aws.client.api/client (api.clj:94).
No known endpoint.
aws-api's interactions with aws are based on data descriptions of their apis: (https://github.com/aws/aws-sdk-js/tree/master/apis)
AWS does not make any promises about those descriptions aligning with specs that other vendors use to make s3-compatible services, so neither can we.
Actually, looking at the error you posted above, "no known endpoint", that comes from aws-api even before trying to send a request out.
OK, so the answer to your original question is that no, aws api does not promise to work with endpoints outside of aws. Please feel free to submit an issue https://github.com/cognitect-labs/aws-api/issues and we can continue the convo there.
When supplying a valid :region
I manged to connect to a NetApp StorageGRID S3 endpoint.
(def s3 (aws/client {:api :s3
:region "us-west-1"
:endpoint-override {:protocol :https
:hostname "<http://s3.example.com|s3.example.com>"}
:credentials-provider (credentials/basic-credentials-provider
{:access-key-id ACCESS_KEY
:secret-access-key SECRET_KEY})}))
(aws/invoke s3 {:op :ListBuckets})
withou :region
the aws/client
runs for a while an than failes with an error:
Execution error (ExceptionInfo) at cognitect.aws.region$chain_region_provider$reify__13062/fetch (region.clj:37).
No region found by any region provider.
with :region "foo"
the error is a little misleading:
Execution error (ExceptionInfo) at cognitect.aws.client.api/client (api.clj:94).
No known endpoint.
… but with :region "eu-central-1"
the client is created and (aws/invoke s3 {:op :ListBuckets})
successfully delivers the expected results
Did you have a region configured in your environment? https://github.com/cognitect-labs/aws-api#region-lookup https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/java-dg-region-selection.html
;; Mock S3 Service ;; https://github.com/adobe/S3Mock ;; https://github.com/adobe/S3Mock/blob/master/server/src/main/java/com/adobe/testing/s3mock/S3MockApplication.java (def props {S3MockApplication/PROP_HTTPS_PORT S3MockApplication/RANDOM_PORT S3MockApplication/PROP_HTTP_PORT S3MockApplication/RANDOM_PORT S3MockApplication/PROP_INITIAL_BUCKETS bucket S3MockApplication/PROP_SILENT “true” }) (def s3mock (S3MockApplication/start (HashMap. props) (into-array String []))) (def s3 (aws-api/client {:api :s3 :endpoint-override {:protocol :http :hostname “localhost” :port (.getHttpPort s3mock)}}))
I think I got it working against locally running mock server
Can you create a presigned url with aws-api?
Ah https://github.com/cognitect-labs/aws-api/issues/5. Anyone have a workaround for now?
It sounds like the pieces are there and just need to be assembled.
the s3 v4 signing api is really straightforward
(the non-streaming variant)