#aws-sdk-rust #aws-secrets-manager #aws-parameter-store #aws


Retrieve AWS secrets and interact with Secrets Manager and SSM Parameter Store

2 releases

0.1.1 Aug 27, 2022
0.1.0 Aug 26, 2022

#24 in #aws-sdk-rust

MIT license

153 lines


github crates.io docs.rs build status

Retrieve AWS secrets and interact with Secrets Manager and SSM Parameter Store.

This crate works with Cargo with a Cargo.toml like:

aws-secrets = { version = "0.1.1", features = ["all"] }
serde_json = "1"  # optional
tokio = { version = "1", features = ["full"] }

Getting started

Add some usage to your application. Here's an example of using aws-secrets in code.

Note: this sample requires the all feature to be enabled.

use aws_secrets::{config_from_env, SSMParamExt, SecretsExt};
use serde_json::{to_string, Value};

async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let shared_config = config_from_env().await;

    // Retrieve a secret from AWS Secrets Manager
    let secret_name = "my-secret";
    let value: Value = secret_name.get_secret(&shared_config).await?;
    let secret_string = to_string(&value)?;
    println!("[{secret_name}] Retrieved secret. value={secret_string}");

    // Retrieve a parameter from AWS SSM Parameter Store
    let param_name = "/my/secure/param";
    let value = param_name.get_secure_string(&shared_config).await?;
    println!("[{param_name}] Retrieved parameter. value={value:?}");



You can check out sample usage of this crate in the examples/ folder in the project repo on GitHub.

Dependencies and Features

This library uses only the minimum required dependencies, in order to keep the overall size small. It leverages the AWS SDK for Rust for making calls to AWS APIs.

Note: Any desired features must be enabled individually, as no features are enabled by default.

Available features

  • all - Enables support for AWS Secrets Manager and SSM Parameter Store.
  • params - Enables support for AWS SSM Parameter Store.
  • sm - Enables support for AWS Secrets Manager.

Enabling Features

Update the project's Cargo.toml to include any optional features to enable:

aws-secrets = { version = "*", features = ["all"] }


Contributions are welcome! Open a pull request to fix a bug, or open an issue to discuss a new feature or change.

Check out the Contributing section in the docs for more info.


This project is proudly licensed under the MIT license (LICENSE or http://opensource.org/licenses/MIT).

aws-secrets can be distributed according to the MIT license. Contributions will be accepted under the same license.



~520K SLoC