@aws-sdk/dsql-signer

中文文档
3.1164.0发布于 2026/11/07Apache-2.0TypeScriptESM + CJS近 30 天下载 91.8万

Dsql utility for generating a password token that can be used for IAM authentication to a Dsql Database.

原始使用文档
文档目录5 节
  1. Description
  2. Installation
  3. Getting Started
  4. Import
  5. Generate Authentication Token for Dsql IAM Authentication

@aws-sdk/dsql-signer

NPM version NPM downloads

Description

This package provides utilities for interacting with Dsql.

Installation

npm install @aws-sdk/dsql-signer

Getting Started

Import

ES6 import

import { DsqlSigner } from "@aws-sdk/dsql-signer";

Or CommonJS import

const { DsqlSigner } = require("@aws-sdk/dsql-signer");

Generate Authentication Token for Dsql IAM Authentication

import { Hash } from "@smithy/hash-node";
import { fromNodeProviderChain } from "@aws-sdk/credential-providers";

const signer = new DsqlSigner({
  /**
   * Required: The hostname of the database to connect to.
   */
  hostname: "foo0bar1baz2quux3quux4.dsql.us-east-1.on.aws",

  /**
   * Optional: The region the database is located in. Uses the region inferred from the runtime if omitted.
   */
  region: "us-east-1",

  /**
   * Optional: The SHA256 hasher constructor to sign the request.
   */
  sha256: Hash.bind(null, "sha256"),

  /**
   * Optional: The amount of time in seconds the generated token is valid
   */
  expiresIn: 3600,

  /**
   * Optional: The AWS credentials to sign requests with. Uses the default credential provider chain if not specified.
   * You can use any credential provider from https://www.npmjs.com/package/@aws-sdk/credential-providers,
   * or provide a credentials object.
   */
  credentials: fromNodeProviderChain(),
});

// Creates auth token.
const authToken = await signer.getDbConnectAuthToken();

// Creates admin auth token.
const adminAuthToken = await signer.getDbConnectAdminAuthToken();

// Use the token as the password for connecting to your Dsql instance.

版本与发布记录

@aws-sdk/dsql-signer 共发布 324 个版本,首次发布于 2024/12/04;过去 12 个月发布了 220 个版本。

版本发布日期距今
3.1164.0latest2026/11/071 天前
3.1163.02026/11/062 天前
3.1162.02026/11/053 天前
3.1161.02026/10/318 天前
3.1160.02026/10/309 天前
3.1159.02026/10/2910 天前

关于 @aws-sdk/dsql-signer 的常见问题

@aws-sdk/dsql-signer 是什么?

Dsql utility for generating a password token that can be used for IAM authentication to a Dsql Database.

如何安装 @aws-sdk/dsql-signer?

在项目目录运行 npm install @aws-sdk/dsql-signer,或使用 pnpm add / yarn add / bun add。

@aws-sdk/dsql-signer 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@aws-sdk/dsql-signer 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@aws-sdk/dsql-signer 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@aws-sdk/dsql-signer 可以商用吗?

@aws-sdk/dsql-signer 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@aws-sdk/dsql-signer 的下载量有多少?

根据 npm 官方下载统计,@aws-sdk/dsql-signer 在 2026/10/08 – 2026/11/06 这 30 天内被下载 918,112 次,日均约 30,604 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@aws-sdk/dsql-signer 还在维护吗?

最新版本 3.1164.0 发布于 2026/11/07(1 天前);至今共发布 324 个版本,其中过去 12 个月发布了 220 个;首次发布于 2024/12/04。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。