Skip to content

@ts-safeql/plugin-auth-aws

Connect to AWS RDS databases using IAM authentication. Generates a short-lived IAM token and connects with SSL.

Installation

bash
pnpm add @ts-safeql/plugin-auth-aws

Usage

js
import safeql from "@ts-safeql/eslint-plugin/config";
import awsIamAuth from "@ts-safeql/plugin-auth-aws";

export default [
  safeql.configs.connections({
    plugins: [
      awsIamAuth({
        databaseHost: "<instance>.<id>.<region>.rds.amazonaws.com",
        databasePort: 5432,
        databaseUser: "iam_user",
        databaseName: "mydb",
        awsRegion: "eu-west-1",
        awsProfile: "my-profile",
      }),
    ],
    targets: [{ tag: "sql" }],
  }),
];

Options

OptionTypeRequiredDescription
databaseHoststringYesRDS hostname
databasePortnumberNoDatabase port (default: 5432)
databaseUserstringYesDatabase user configured for IAM auth
databaseNamestringYesDatabase name
awsRegionstringYesAWS region (e.g., "eu-west-1")
awsProfilestringNoAWS profile from ~/.aws/credentials. If omitted, uses the default credential chain.

Prerequisites

TIP

If using SSO, run aws sso login --profile <your-profile> before linting.