Skip to content
This repository has been archived by the owner on May 28, 2020. It is now read-only.

Use CredentialsProviders à la the Java API (NOT YET DOCUMENTED) #25

Closed
wants to merge 1 commit into from

Conversation

shlevy
Copy link

@shlevy shlevy commented Aug 29, 2013

This PR changes Net::Amazon::S3 to use CredentialsProviders instead of only fixed credentials to access S3 (while maintaining backwards compatibility). The added CredentialsProvider implementations match the official Java SDK (minus the one using JVM properties for obvious reasons), and the default for credentials_provider matches as well.

In practice, what this means is that if you create a new Net::Amazon::S3 instance with no credentials, it will check the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables (also the less-used AWS_SESSION_TOKEN), and if those are not set it will look for credentials provided by instance metadata on EC2 instances with attached IAM roles. Previously-working scripts should still work: If credentials are provided to the constructor instead of a CredentialsProvider, then we create a FixedCredentialsProvider under the hood using the supplied creds.

Note that this is my first time working with Moose and I have not yet learned how to write POD documentation, so this is as-yet undocumented and may contain obvious mistakes. I'm happy to take the time to learn to document this, but before I do so I'd like to know if this change is conceivably welcome or not.

Signed-off-by: Shea Levy <shea@shealevy.com>
chexxor pushed a commit to chexxor/nixos-configurations that referenced this pull request Nov 6, 2013
…nt/instance roles

See pfig/net-amazon-s3#25

Signed-off-by: Shea Levy <shea@shealevy.com>
@rustyconover
Copy link
Collaborator

This is already built into 0.80 with the use_iam_role option upon creation.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants