#AWS #S3 #Wasabi #Minio #Yandex

aws-creds

Tiny Rust library for working with Amazon IAM credential,s, supports s3 crate

8 unstable releases (3 breaking)

0.23.1 Jul 14, 2020
0.23.0 Jul 13, 2020
0.22.3 Jul 29, 2020
0.22.1 Jun 17, 2020
0.20.0 Mar 28, 2020

#2 in #yandex

Download history 84/week @ 2020-04-19 105/week @ 2020-04-26 88/week @ 2020-05-03 74/week @ 2020-05-10 97/week @ 2020-05-17 218/week @ 2020-05-24 272/week @ 2020-05-31 331/week @ 2020-06-07 257/week @ 2020-06-14 299/week @ 2020-06-21 213/week @ 2020-06-28 359/week @ 2020-07-05 287/week @ 2020-07-12 411/week @ 2020-07-19 280/week @ 2020-07-26 227/week @ 2020-08-02

1,051 downloads per month
Used in rust-s3

MIT license

14KB
237 lines

Example

// AWS access credentials: access key, secret key, and optional token.
# Example
// Loads from the standard AWS credentials file with the given profile name,
// defaults to "default".
use awscreds::Credentials;

// Load credentials from `[default]` profile
let credentials = Credentials::default();
// Also loads credentials from `[default]` profile
let credentials = Credentials::new(None, None, None, None);
// Load credentials from `[my-profile]` profile
let credentials = Credentials::new(None, None, None, Some("my-profile".into()));
// Credentials may also be initialized directly or by the following environment variables:
//   - `AWS_ACCESS_KEY_ID`,
//   - `AWS_SECRET_ACCESS_KEY`
//   - `AWS_SESSION_TOKEN`
// The order of preference is arguments, then environment, and finally AWS
// credentials file.

use s3::credentials::Credentials;
// Load credentials directly
let access_key = String::from("AKIAIOSFODNN7EXAMPLE");
let secret_key = String::from("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY");
let credentials = Credentials::new(Some(access_key), Some(secret_key), None, None);
// Load credentials from the environment
use std::env;
env::set_var("AWS_ACCESS_KEY_ID", "AKIAIOSFODNN7EXAMPLE");
env::set_var("AWS_SECRET_ACCESS_KEY", "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY");
let credentials = Credentials::new(None, None, None, None);

Dependencies

~4.5MB
~97K SLoC