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

aws-creds

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

28 releases (18 breaking)

0.38.0 Aug 30, 2024
0.37.0 Jun 14, 2024
0.36.0 Oct 15, 2023
0.35.0 Apr 7, 2023
0.20.0 Mar 28, 2020

#1879 in Network programming

Download history 17189/week @ 2024-08-23 20562/week @ 2024-08-30 21215/week @ 2024-09-06 18823/week @ 2024-09-13 20397/week @ 2024-09-20 19519/week @ 2024-09-27 21610/week @ 2024-10-04 25274/week @ 2024-10-11 25356/week @ 2024-10-18 28957/week @ 2024-10-25 25822/week @ 2024-11-01 22326/week @ 2024-11-08 22383/week @ 2024-11-15 23572/week @ 2024-11-22 22497/week @ 2024-11-29 20235/week @ 2024-12-06

92,654 downloads per month
Used in 48 crates (5 directly)

MIT license

23KB
419 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
~157K SLoC