Skip to content

Commit f7a47c7

Browse files
committed
docs: update sample code to use new connection parameters
1 parent 9da3730 commit f7a47c7

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

docs/using-the-nodejs-wrapper/using-plugins/UsingTheAwsSecretsManagerPlugin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The following properties are required for the AWS Secrets Manager Connection Plu
2121
> To use this plugin, you will need to set the following AWS Secrets Manager specific parameters.
2222
2323
| Parameter | Value | Required | Description | Example | Default Value |
24-
|--------------------------|:-------:|:-----------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------|---------------|
24+
| ------------------------ | :-----: | :---------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------- | ------------- |
2525
| `secretId` | String | Yes | Set this value to be the secret name or the secret ARN. | `secretId` | `null` |
2626
| `secretRegion` | String | Yes unless the `secretId` is an ARN | Set this value to be the region your secret is in. | `us-east-2` | `null` |
2727
| `secretEndpoint` | String | No | Set this value to be the endpoint override to retrieve your secret from. This parameter value should be in the form of a URL, with a valid protocol (ex. `https://`) and domain (ex. `localhost`). A port number is not required. | `https://localhost:1234` | `null` |

examples/aws_driver_example/aws_secrets_manager_mysql_example.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const mysqlHost = "db-identifier.XYZ.us-east-2.rds.amazonaws.com";
2020
const port = 3306;
2121
const secretId = "SecretName";
2222
const secretRegion = "us-east-1";
23+
const secretExpirationTime = 1000;
2324
/* secretId can be set as secret ARN instead. The ARN includes the secretRegion */
2425
// const secretId = "arn:aws:secretsmanager:us-east-1:AccountId:secret:SecretName-6RandomCharacters";
2526

@@ -29,7 +30,13 @@ const client = new AwsMySQLClient({
2930
port: port,
3031
secretId: secretId,
3132
secretRegion: secretRegion,
32-
plugins: "secretsManager"
33+
secretExpirationSec: secretExpirationTime,
34+
plugins: "secretsManager",
35+
// By default, the Secrets Manager plugin assumes the secret stored in the AWS Secrets Manager to be a JSON object containing the properties `username` and `password`.
36+
// If the secret contains different key names, you can specify them with the `secretUsernameProperty` and `secretPasswordProperty` parameters.
37+
// This example assumes the credentials are stored under the keys db_user and db_pass.
38+
secretUsernameProperty: "db_user",
39+
secretPasswordProperty: "db_pass"
3340
});
3441

3542
// Attempt connection.

0 commit comments

Comments
 (0)