#vault #iam #amazon-iam #aws #hashi-corp #api-bindings

yanked vault_iam_auth

HashiCorp Vault authentication for the AWS IAM engine

3 unstable releases

0.2.0 Aug 5, 2021
0.1.1 Aug 2, 2021
0.1.0 Jul 30, 2021

#21 in #amazon-iam

MIT license

13KB
68 lines

Vault IAM Authentication

crates.io Released API docs MIT licensed

Tiny library for Vault authentication using the AWS IAM engine.

Example

The authenticate function returns a serde_json::Value of the standard Vault login API response body.

use std::error::Error;

use serde_json::Value;
use vault_iam_auth::{authenticate, Parameters};

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
  let params = Parameters {
    iam_server_id: None,
    mount_path: String::from("aws"),
    role: String::from("my-role"),
    vault_address: String::from("https://vault.address.com:8200"),
  };

  let response: serde_json::Value = authenticate(&params).await?;

  let token = response
    .get("auth")
    .unwrap()
    .get("client_token")
    .unwrap()
    .as_str()
    .unwrap();
  println!("{}", token);
  Ok(())
}

Dependencies

~12–28MB
~362K SLoC