UNPKG

cdk-rds-sql

Version:

A CDK construct that allows creating roles or users and databases an on Aurora Serverless Postgresql or Mysql/MariaDB cluster.

77 lines (76 loc) 2.41 kB
import { Duration } from "aws-cdk-lib"; import { IVpc, SubnetSelection } from "aws-cdk-lib/aws-ec2"; import { IFunction } from "aws-cdk-lib/aws-lambda"; import * as lambda from "aws-cdk-lib/aws-lambda-nodejs"; import { NodejsFunctionProps } from "aws-cdk-lib/aws-lambda-nodejs"; import { IDatabaseCluster, IDatabaseInstance } from "aws-cdk-lib/aws-rds"; import { ISecret } from "aws-cdk-lib/aws-secretsmanager"; import { Construct } from "constructs"; export interface RdsSqlProps { /** * VPC network to place the provider lambda. * * Normally this is the VPC of your database. * * @default - Function is not placed within a VPC. */ readonly vpc: IVpc; /** * Where to place the network provider lambda within the VPC. * * @default - the isolated subnet if not specified */ readonly vpcSubnets?: SubnetSelection; /** * Your database. */ readonly cluster: IDatabaseCluster | IDatabaseInstance; /** * Secret that grants access to your database. * * Usually this is your cluster's master secret. */ readonly secret: ISecret; /** * Timeout for lambda to do its work. * * @default - 5 minutes */ readonly timeout?: Duration; /** * Log SQL statements. This includes passwords. Use only for debugging. * * @default - false */ readonly logger?: boolean; /** * Additional function customization. * * This enables additional function customization such as the log group. However, * lambda function properties controlled by other {RdsSqlProps} parameters will trump * opions set via this parameter. * * @default - empty */ readonly functionProps?: NodejsFunctionProps; /** * Use SSL? * * @default - false */ readonly ssl?: boolean; } export declare class Provider extends Construct { readonly serviceToken: string; readonly secret: ISecret; readonly handler: IFunction; readonly cluster: IDatabaseCluster | IDatabaseInstance; /** * The engine like "postgres" or "mysql" * * @default - if we cannot determine this "postgres" */ readonly engine: string; constructor(scope: Construct, id: string, props: RdsSqlProps); protected newCustomResourceHandler(scope: Construct, id: string, props: RdsSqlProps): lambda.NodejsFunction; }