#AWS #S3 #Wasabi #Minio #Yandex

aws-creds

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

12 releases (5 breaking)

0.25.0 Nov 15, 2020
0.23.4 Sep 10, 2020
0.23.1 Jul 14, 2020
0.20.0 Mar 28, 2020

#19 in Authentication

Download history 419/week @ 2020-08-11 429/week @ 2020-08-18 809/week @ 2020-08-25 667/week @ 2020-09-01 685/week @ 2020-09-08 582/week @ 2020-09-15 506/week @ 2020-09-22 712/week @ 2020-09-29 553/week @ 2020-10-06 681/week @ 2020-10-13 774/week @ 2020-10-20 903/week @ 2020-10-27 848/week @ 2020-11-03 927/week @ 2020-11-10 716/week @ 2020-11-17 648/week @ 2020-11-24

2,972 downloads per month
Used in 4 crates (via rust-s3)

MIT license

17KB
318 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.5–8MB
~183K SLoC