Skip to content

Commit b094ec4

Browse files
committed
feat(nested-clients): create nested clients for internal sts usage
1 parent 0bde6b6 commit b094ec4

File tree

9 files changed

+169
-0
lines changed

9 files changed

+169
-0
lines changed

packages/nested-clients/CHANGELOG.md

Whitespace-only changes.

packages/nested-clients/README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# @aws-sdk/rds-signer
2+
3+
[![NPM version](https://img.shields.io/npm/v/@aws-sdk/rds-signer/latest.svg)](https://www.npmjs.com/package/@aws-sdk/rds-signer)
4+
[![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/rds-signer.svg)](https://www.npmjs.com/package/@aws-sdk/rds-signer)
5+
6+
## Description
7+
8+
This package provides utilities for interacting with RDS.
9+
10+
## Installation
11+
12+
```console
13+
npm install @aws-sdk/rds-signer
14+
```
15+
16+
## Getting Started
17+
18+
### Import
19+
20+
ES6 import
21+
22+
```js
23+
import { Signer } from "@aws-sdk/rds-signer";
24+
```
25+
26+
Or CommonJS import
27+
28+
```js
29+
const { Signer } = require("@aws-sdk/rds-signer");
30+
```
31+
32+
### Generate Authentication Token for RDS IAM Authentication
33+
34+
```js
35+
const signer = new Signer({
36+
/**
37+
* Required. The hostname of the database to connect to.
38+
*/
39+
hostname: "db.us-east-1.rds.amazonaws.com",
40+
/**
41+
* Required. The port number the database is listening on.
42+
*/
43+
port: 8000,
44+
/**
45+
* Required. The username to login as.
46+
*/
47+
username: "user1",
48+
/**
49+
* Optional. The AWS credentials to sign requests with. Uses the default credential provider chain in not specified.
50+
*/
51+
credentials: fromNodeCredentialProvider(),
52+
/**
53+
* Optional. The region the database is located in. Uses the region inferred from the runtime if omitted.
54+
*/
55+
region: "us-east-1",
56+
/**
57+
* Optional. The SHA256 hasher constructor to sign the request.
58+
*/
59+
sha256: HashCtor,
60+
});
61+
62+
const token = await signer.getAuthToken();
63+
// Use this token as the password for connecting to your RDS instance
64+
```
65+
66+
For more details and examples, refer to the following resources. Usage is similar across DB engines.
67+
68+
- [Connecting to your DB instance using IAM authentication](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.Connecting.html)
69+
- [IAM database authentication for MySQL and PostgreSQL](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html)
70+
- [Using IAM authentication to connect with pgAdmin Amazon Aurora PostgreSQL or Amazon RDS for PostgreSQL](https://aws.amazon.com/blogs/database/using-iam-authentication-to-connect-with-pgadmin-amazon-aurora-postgresql-or-amazon-rds-for-postgresql/)
71+
- [Use IAM authentication to connect with SQL Workbench/J to Amazon Aurora MySQL or Amazon RDS for MySQL](https://aws.amazon.com/blogs/database/use-iam-authentication-to-connect-with-sql-workbenchj-to-amazon-aurora-mysql-or-amazon-rds-for-mysql/)
72+
- [AWS CLI v2 rds generate-db-auth-token Documentation](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/rds/generate-db-auth-token.html)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "../../api-extractor.packages.json",
3+
"mainEntryPointFilePath": "./dist-types/index.d.ts"
4+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"name": "@aws-sdk/nested-clients",
3+
"version": "3.0.0",
4+
"description": "Nested clients for AWS SDK packages.",
5+
"main": "./dist-cjs/index.js",
6+
"module": "./dist-es/index.js",
7+
"types": "./dist-types/index.d.ts",
8+
"scripts": {
9+
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
10+
"build:cjs": "node ../../scripts/compilation/inline nested-clients",
11+
"build:es": "tsc -p tsconfig.es.json",
12+
"build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
13+
"build:types": "tsc -p tsconfig.types.json",
14+
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
15+
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
16+
"extract:docs": "api-extractor run --local",
17+
"test": "yarn g:vitest run",
18+
"test:watch": "yarn g:vitest watch"
19+
},
20+
"engines": {
21+
"node": ">=18.0.0"
22+
},
23+
"author": {
24+
"name": "AWS SDK for JavaScript Team",
25+
"url": "https://aws.amazon.com/javascript/"
26+
},
27+
"license": "Apache-2.0",
28+
"dependencies": {
29+
"tslib": "^2.6.2"
30+
},
31+
"devDependencies": {
32+
"concurrently": "7.0.0",
33+
"downlevel-dts": "0.10.1",
34+
"rimraf": "3.0.2",
35+
"typescript": "~5.2.2"
36+
},
37+
"typesVersions": {
38+
"<4.0": {
39+
"dist-types/*": [
40+
"dist-types/ts3.4/*"
41+
]
42+
}
43+
},
44+
"files": [
45+
"dist-*/**"
46+
],
47+
"browser": {},
48+
"react-native": {},
49+
"homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/packages/nested-clients",
50+
"repository": {
51+
"type": "git",
52+
"url": "https://github.com/aws/aws-sdk-js-v3.git",
53+
"directory": "packages/nested-clients"
54+
}
55+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": ".",
4+
"outDir": "dist-cjs",
5+
"rootDir": "src"
6+
},
7+
"extends": "../../tsconfig.cjs.json",
8+
"include": ["src/"]
9+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": ".",
4+
"lib": ["dom"],
5+
"outDir": "dist-es",
6+
"rootDir": "src"
7+
},
8+
"extends": "../../tsconfig.es.json",
9+
"include": ["src/"]
10+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": ".",
4+
"declarationDir": "dist-types",
5+
"rootDir": "src"
6+
},
7+
"extends": "../../tsconfig.types.json",
8+
"include": ["src/"]
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { defineConfig } from "vitest/config";
2+
3+
export default defineConfig({
4+
test: {
5+
exclude: ["**/*.{integ,e2e,browser}.spec.ts"],
6+
include: ["**/*.spec.ts"],
7+
environment: "node",
8+
},
9+
});

0 commit comments

Comments
 (0)