#aws-access #aws-credentials #amazon-iam #aws #s3 #minio #wasabi

femlol-aws-creds

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

5 releases

0.39.0 Mar 27, 2024
0.37.3 Feb 11, 2024
0.37.2 Feb 11, 2024
0.37.1 Feb 11, 2024
0.37.0 Feb 11, 2024

#7 in #wasabi

Download history 6/week @ 2024-08-31 19/week @ 2024-09-07 1/week @ 2024-09-14 13/week @ 2024-09-21 12/week @ 2024-09-28 3/week @ 2024-10-12 1/week @ 2024-10-19 1/week @ 2024-11-09 32/week @ 2024-11-16 111/week @ 2024-11-23 22/week @ 2024-11-30 43/week @ 2024-12-07 24/week @ 2024-12-14

205 downloads per month
Used in s3-tokio

MIT license

22KB
376 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

~5–13MB
~151K SLoC