What is @aws-sdk/rds-signer?
@aws-sdk/rds-signer is an AWS SDK package that allows you to generate an authentication token for connecting to an Amazon RDS database. This token can be used in place of a password when connecting to the database, providing a secure way to authenticate without hardcoding credentials.
Generate Authentication Token
This feature allows you to generate an authentication token for connecting to an Amazon RDS database. The token can be used in place of a password, providing a secure way to authenticate without hardcoding credentials.
const { RDSClient, CreateDBInstanceCommand } = require('@aws-sdk/client-rds');
const { RDSAuthTokenGenerator } = require('@aws-sdk/rds-signer');
const client = new RDSClient({ region: 'us-west-2' });
const signer = new RDSAuthTokenGenerator(client);
const authToken = signer.getAuthToken({
hostname: 'mydbinstance.123456789012.us-west-2.rds.amazonaws.com',
port: 3306,
username: 'mydbuser'
});
console.log(`Generated Auth Token: ${authToken}`);