durch / rust-s3

Rust library for interfacing with S3 API compatible services
MIT License
519 stars 198 forks source link

Enable getting credentials from http://169.254.169.254:80 when not on ec2 #362

Closed droundy closed 4 weeks ago

droundy commented 11 months ago

Is your feature request related to a problem? Please describe.

I would like for aws-creds to pick up the credentials from http://169.254.169.254:80 if present, even if not running on ec2. We use a system that sets up AWS credentials on this port on developer machines, which works fine with e.g. aws s3 cp, because it looks at http://169.254.169.254:80 and finds the credentials as if our developer machines were on ec2. In order for rust-s3 to be useful to us, we'd like to be able to pick up those credentials, so I can use it to build tools that are widely and easily used within my organization.

Describe the solution you'd like

I'd like for the is_ec2() call to be removed (or made in some way optional) from from_instance_metadata().

Describe alternatives you've considered

There could be a separate constructor that omits the check for is_ec2(). This could be something like Credentials::from_hologram()` potentially, although it would also work on ec2.

Additional context

The system we're using is called hologram: https://github.com/AdRoll/hologram