@finnairoyj/cdk-constructs-lib
    Preparing search index...
    interface ExecuteSQLStatementProps {
        dbCredentialsSecret: ISecret;
        dbEngine?: DatabaseEngine;
        dbHost?: string;
        dbName?: string;
        dbPort?: string;
        kmsKey?: IKey;
        onCreateSQL: string;
        onDeleteSQL?: string;
        onUpdateSQL?: string;
        sqlExecutorLambda?: IFunction;
        timeout?: Duration;
        updateTimestamp?: number;
        vpc?: IVpc;
        vpcSubnets?: SubnetSelection;
    }
    Index

    Properties

    dbCredentialsSecret: ISecret

    ARN of the secret in Secrets Manager containing the database credentials.

    The secret must be encrypted with the KMS key provided. The secret must contain JSON in the following format:

    {
    "dbClusterIdentifier": "db_cluster_id",
    "dbname": "db_name",
    "engine": "[mysql|postgres]",
    "host": "db_host",
    "password": "db_password",
    "port": "db_port",
    "username": "db_username"
    }
    dbEngine?: DatabaseEngine

    Database engine to use. Required if dbCredentialsSecretArn is not provided.

    dbHost?: string

    Database hostname. Required if dbCredentialsSecretArn is not provided.

    dbName?: string

    Database name. Required if dbCredentialsSecretArn is not provided.

    mysql for MySQL
    
    postgres for PostgreSQL
    
    dbPort?: string

    Database port. Required if dbCredentialsSecretArn is not provided.

    3306 for MySQL
    
    5432 for PostgreSQL
    
    kmsKey?: IKey

    KMS key used to encrypt the database credentials. Required if sqlExecutorLambda is not provided.

    onCreateSQL: string

    The SQL statement to execute when the custom resource is created. The SQL statement must be a valid SQL statement for the database engine. Multiple statements can be separated by a semicolon.

    If it is not desired to execute a statement on create, use a statement that does not modify the database, such as a SELECT NOW() statement.

    The query supports tokenized parameters that can be resolved either from SSM parameters or Secrets Manager secrets before execution of the statement. The parameters must be provided in the following format:

    -- Resolve value from SSM parameter. Set the second parameter to true
    -- to resolve the value of a SecureString parameter.
    SELECT * FROM §SSM@ssm_parameter_name~[true|falseWHERE...

    -- Resolve value from Secrets Manager secret
    SELECT * FROM §SECRET@secret_name~json_key_to_resolve§ WHERE...
    SELECT NOW();
    SELECT * FROM §SSM@/my/ssm/parameter~true§ ORDER BY id DESC;
    SELECT * FROM §SECRET@my-secret-name~tableName§ ORDER BY id DESC;
    onDeleteSQL?: string

    The SQL statement to execute when the custom resource is updated. The SQL statement must be a valid SQL statement for the database engine. Multiple statements can be separated by a semicolon.

    onUpdateSQL?: string

    The SQL statement to execute when the custom resource is updated. The SQL statement must be a valid SQL statement for the database engine. Multiple statements can be separated by a semicolon.

    sqlExecutorLambda?: IFunction

    The Custom Resource Lambda function to use for executing SQL statements. If not provided, a new Lambda function will be created.

    timeout?: Duration

    SQL executor lambda timeout. Has effect only if sqlExecutorLambda is not provided.

    10 minutes
    
    updateTimestamp?: number

    Update the timestamp to trigger update event and execution of the onUpdateSQL statement on the stack deployment. Has no other effect.

    - No updates are triggered on stack deployment
    
    Date.now() to trigger update event on every deployment
    
    vpc?: IVpc

    VPC to use for the Lambda function. Has effect only if sqlExecutorLambda is not provided.

    - The LZ Managed VPC
    
    vpcSubnets?: SubnetSelection

    Subnets to use for the Lambda function. Has effect only if sqlExecutorLambda is not provided.

    - Private subnets in the LZ Managed VPC