AWS Secrets Manager Rust Caching Client
The AWS Secrets Manager Rust Caching Client enables in-process caching of secrets for Rust applications.
Getting Started
Required Prerequisites
To use this client you must have:
- A Rust 2021 development environment. If you do not have one, go to Rust Getting Started on the Rust Programming Language website, then download and install Rust.
- An Amazon Web Services (AWS) account to access secrets stored in AWS Secrets Manager.
- To create an AWS account, go to Sign In or Create an AWS Account and then choose I am a new user. Follow the instructions to create an AWS account.
- To create a secret in AWS Secrets Manager, go to Creating Secrets and follow the instructions on that page.
Get Started
The following code sample demonstrates how to get started:
- Instantiate the caching client.
- Request secret.
use SecretsManagerCachingClient;
use NonZeroUsize;
use Duration;
let client = match default
.await
;
let secret_string = match client.get_secret_value.await ;
// Your code here
Cache Configuration
max_size: NonZeroUsize
: The maximum number of cached secrets to maintain before evicting secrets that have not been accessed recently.ttl: Duration
: The duration a cached item is considered valid before requiring a refresh of the secret state.
Instantiating Cache with a custom Config and a custom Client
let config = load_defaults
.await
.into_builder
.region
.build;
let asm_builder = from;
let client = match from_builder
.await
;
let secret_string = client
.get_secret_value
.await
;
// Your code here
Getting Help
Please use these community resources for getting help:
- Ask a question on Stack Overflow and tag it with aws-secrets-manager.
- Open a support ticket with AWS Support
- If it turns out that you may have found a bug, or have a feature request, please open an issue.