-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support loading credentials from standard config / environment (via AWSCredentialsProvider) #69
Comments
Actually I realised the problem is bigger, since all the other functions take a credentials map rather than accept an AmazonS3Client object itself. It'd be nice if it supported passing in the AmazonS3Client directly, and/or some way to specify in the credentials map for it to use one of the standard AWSCredentialsProvider subclasses |
A simple way to do it is by just changing the client construction from: That invocation uses the default credentials provider chain. Unfortunately |
I feel that I should point out that the |
In what way is At any rate, the data is not actually the interesting part of My interest in this comes from being a user of |
What I mean is: (defn- aws-cred-map [^AWSCredentials aws-creds]
{:access-key (.getAWSAccessKeyId aws-creds)
:secret-key (.getAWSSecretKey aws-creds)})
(defn default-aws-creds []
(-> (DefaultAWSCredentialsProviderChain.) .getCredentials aws-cred-map)) |
I don't understand AWS well enough to know why this is, but when I just let it use the credentials object from the provider chain, I can sign S3 requests in such a way that they work, while when I pull an access/secret key out of the credentials and try to just use those, request-signing breaks. |
Hi @MichaelBlume, If you're pulling an access/secret key out of a credential derived from an IAM Instance Profile (or any delegated account which is assuming a role from the same or another account via the AWS Security Token Service, you need three pieces to authenticate:
See http://docs.aws.amazon.com/STS/latest/UsingSTS/CreatingSessionTokens.html for details. |
I think this library is basically deprecated. We should use Amazonica, or something else like https://github.com/cognitect-labs/aws-api, instead. That said, we have some old projects that can't easily be migrated off weavejester/clj-aws-s3.
This library does actually support session token. Take a look at 8e36b2d. So I was able to work around the lack of support for the DefaultCredentialsProviderChain in clj-aws-s3 by instantiating the chain myself, calling getCredentials, and building a map with |
A small feature request. To be honest this isn't particularly hard to do directly:
But it'd be nice if this could be achieved via your
s3-client
function too so you can combine it the clojurey conventions for specifying the ClientConfiguration.The text was updated successfully, but these errors were encountered: