cdk-rds-sql
Version:
A CDK construct that allows creating roles or users and databases an on Aurora Serverless Postgresql or Mysql/MariaDB cluster.
83 lines (82 loc) • 2.54 kB
TypeScript
import * as kms from "aws-cdk-lib/aws-kms";
import { ISecret } from "aws-cdk-lib/aws-secretsmanager";
import { Construct } from "constructs";
import { IDatabase } from "./database";
import { Provider } from "./provider";
export interface RoleProps {
/**
* Provider.
*/
readonly provider: Provider;
/**
* SQL.
*/
readonly roleName: string;
/**
* Optional database this user is expected to use.
*
* If the database exists, connect privileges are granted.
*
* Specify one of `database` or `databaseName`. This is the name
* that will be stored in the role's secret as the database name to
* use.
*/
readonly database?: IDatabase;
/**
* Optional database name this user is expected to use.
*
* If the database exists, connect privileges are granted.
*
* Specify one of `database` or `databaseName`. This is the name
* that will be stored in the role's secret as the database name to
* use.
*/
readonly databaseName?: string;
/**
* A new secret is created for this user.
*
* Optionally encrypt it with the given key.
*/
readonly encryptionKey?: kms.IKey;
/**
* A new secret is created for this user.
*
* Optionally add secret name to the secret.
*/
readonly secretName?: string;
/**
* Prefix for SSM parameters to store credentials in Parameter Store.
* When defined, credentials will also be stored as parameters.
*
* The parameter names such as "password" is simply appended to
* `parameterPrefix`, so make sure the prefix ends with a slash if
* you have your parameter names slash separated.
*
* Note that the password from the secret is copied just once, they
* are not kept in sync.
*
* @default - credentials are only stored in Secrets Manager
*/
readonly parameterPrefix?: string;
/**
* Enable IAM authentication for this role.
*
* When enabled, the role will be created without a password and
* configured for AWS IAM database authentication. The secret
* will not contain a password field.
*
* @default false - use password authentication
*/
readonly enableIamAuth?: boolean;
}
export declare class Role extends Construct {
/**
* The role name.
*/
readonly roleName: string;
/**
* The generated secret.
*/
readonly secret: ISecret;
constructor(scope: Construct, id: string, props: RoleProps);
}