@aws-sdk/dsql-signer

Installation

NPM
npm install @aws-sdk/dsql-signer
Yarn
yarn add @aws-sdk/dsql-signer
pnpm
pnpm add @aws-sdk/dsql-signer

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

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?: HashCtor;

  /**
   * 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.
   */
  credentials?: fromNodeCredentialProvider();
});

// 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.

Types

Type Name
Type
DsqlSignerClass
DsqlSignerConfigInterface