| Crates.io | aws-rds-signer |
| lib.rs | aws-rds-signer |
| version | 0.2.0 |
| created_at | 2025-03-14 00:52:07.084855+00 |
| updated_at | 2025-03-14 05:42:14.870945+00 |
| description | A Rust library for generating AWS IAM authentication tokens for Amazon RDS database connections |
| homepage | |
| repository | https://github.com/wnml-org/aws-rds-signer |
| max_upload_size | |
| id | 1591689 |
| size | 66,856 |
A Rust library for generating AWS IAM authentication tokens for Amazon RDS database connections. This library simplifies the process of authenticating to RDS instances using IAM roles and credentials.
Generate IAM authentication tokens for RDS database connections
Support for custom expiration times
Automatic region detection from AWS configuration
Simple builder-style API
Async/await support
Zero dependencies on AWS SDK (uses lightweight AWS signature v4 implementation)
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.Connecting.html
https://github.com/aws/aws-sdk-js-v3/blob/main/packages/rds-signer/src/Signer.ts
Add this to your Cargo.toml:
[dependencies]
aws-rds-signer = "0.1.0"
Here's a basic example of how to use the library:
use aws_rds_signer::Signer;
use std::time::Duration;
#[tokio::main]
async fn main() -> Result<(), aws_rds_signer::Error> {
let mut signer = Signer::default();
// Configure the signer
signer
.host("your-db-instance.region.rds.amazonaws.com".to_string())
.port(5432)
.user("your_db_user".to_string())
.expires_in(Duration::from_secs(900)) // 15 minutes
.region(Some("us-east-1".to_string())); // Optional, will use default region if not specified
// Fetch the authentication token
let token = signer.fetch_token().await?;
// Use the token in your database connection string
println!("Authentication token: {}", token);
Ok(())
}
The Signer struct supports the following configuration options:
host: The hostname of your RDS instanceport: The port number the database is listening onuser: The database usernameexpires_in: Token expiration duration (defaults to 900 seconds)region: AWS region (optional, will use the region from your AWS configuration)This project is licensed under the MIT License - see the LICENSE file for details.