cdk-rds-sql 6.1.4 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.jsii CHANGED
@@ -7,7 +7,7 @@
7
7
  ]
8
8
  },
9
9
  "bundled": {
10
- "@types/aws-lambda": "^8.10.150"
10
+ "@types/aws-lambda": "^8.10.152"
11
11
  },
12
12
  "dependencies": {
13
13
  "aws-cdk-lib": "^2.189.1",
@@ -3954,7 +3954,7 @@
3954
3954
  "stability": "stable"
3955
3955
  },
3956
3956
  "homepage": "https://github.com/berenddeboer/cdk-rds-sql.git",
3957
- "jsiiVersion": "5.7.20 (build 433aee4)",
3957
+ "jsiiVersion": "5.9.4 (build db676e9)",
3958
3958
  "keywords": [
3959
3959
  "aurora",
3960
3960
  "aws",
@@ -3975,7 +3975,7 @@
3975
3975
  },
3976
3976
  "name": "cdk-rds-sql",
3977
3977
  "readme": {
3978
- "markdown": "# About\n\nThis CDK construct library makes it possible to create databases,\nschemas, and roles in an Aurora Serverless v2, RDS Database Cluster or\nDatabase Instance. Both PostgreSQL and MySQL databases are supported.\n\nThis construct library is intended to be used in enterprise\nenvironments, and works in isolated subnets.\n\n<p align=\"left\">\n <a href=\"https://github.com/semantic-release/semantic-release\"><img src=\"https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release\" alt=semantic-release: angular\"></a>\n <a href=\"https://github.com/berenddeboer/cdk-rds-sql/actions/workflows/release.yml\"><img src=\"https://github.com/berenddeboer/cdk-rds-sql/actions/workflows/release.yml/badge.svg\" alt=\"Release badge\"></a>\n</p>\n\n# Requirements\n\n- CDK v2.\n\n# Installation\n\n npm i cdk-rds-sql\n\n# Usage\n\n## Provider\n\nFirst setup your VPC and create your cluster:\n\n```ts\nimport { Duration, RemovalPolicy } from \"aws-cdk-lib\"\nimport * as ec2 from \"aws-cdk-lib/aws-ec2\"\nimport * as rds from \"aws-cdk-lib/aws-rds\"\n\nconst vpc = ec2.Vpc.fromLookup(this, \"Vpc\", {\n vpcId: this.node.tryGetContext(\"vpc-id\"),\n})\n\nconst cluster = new rds.ServerlessCluster(this, \"Cluster\", {\n vpc: vpc,\n vpcSubnets: {\n subnetType: ec2.SubnetType.PRIVATE_ISOLATED,\n },\n engine: rds.DatabaseClusterEngine.AURORA_POSTGRESQL,\n parameterGroup: rds.ParameterGroup.fromParameterGroupName(\n this,\n \"ParameterGroup\",\n \"default.aurora-postgresql11\"\n ),\n removalPolicy: RemovalPolicy.DESTROY,\n scaling: {\n autoPause: Duration.minutes(60),\n minCapacity: rds.AuroraCapacityUnit.ACU_2,\n maxCapacity: rds.AuroraCapacityUnit.ACU_2,\n },\n})\n```\n\nThen create a provider which will connect to your database. For a cluster:\n\n```ts\nimport { Provider } from \"cdk-rds-sql\"\n\nconst provider = new Provider(this, \"Provider\", {\n vpc: vpc,\n cluster: cluster,\n secret: cluster.secret!,\n})\n```\n\nFor an instance:\n\n```ts\nimport { Provider } from \"cdk-rds-sql\"\n\nconst provider = new Provider(this, \"Provider\", {\n vpc: vpc,\n instance: instance,\n secret: cluster.secret!,\n})\n```\n\nThe provider will setup a lambda, which normally lives in the same VPC\nas the database. You can give a different VPC, as long as that VPC has\naccess to the VPC of the database. Only the provider lambda will talk\nto your database.\n\nThe provider will by default use the private isolated subnet of the\nVPC. Your isolated network must have a VPC endpoint to AWS Secrets Manager\nand possibly KMS as well. If you want to use a subnet with egress\naccess in case you have no such VPC endpoints, specify the subnet as\nfollows:\n\n```ts\nimport { Provider } from \"cdk-rds-sql\"\n\nconst provider = new Provider(this, \"Provider\", {\n vpc: vpc,\n vpcSubnets: {\n subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS,\n },\n cluster: cluster,\n secret: cluster.secret!,\n})\n```\n\n### Disabling SSL\n\nThe default connection to RDS is ssl enabled (this used to be disabled\nin versions below 4).\n\nYou can disable ssl by setting the `ssl` option to `false`:\n\n```ts\nconst provider = new Provider(this, \"Provider\", {\n vpc: vpc,\n instance: instance,\n secret: cluster.secret!,\n ssl: false, // default is true\n})\n```\n\n## Roles\n\nCreate a postgres role (or mysql user) for a cluster as follows:\n\n```ts\nimport { Role } from \"cdk-rds-sql\"\n\nconst role = new Role(this, \"Role\", {\n provider: provider,\n roleName: \"myrole\",\n databaseName: \"mydb\",\n})\n```\n\nThis will automatically create a secret just like `ServerlessCluster`\ndoes, with all the connection info needed for this user. It's secret value is a JSON like:\n\n```json\n{\n \"dbClusterIdentifier\": \"teststack-clustereb1186t9-sh4wpqfdyfvu\",\n \"password\": \"very-long-and-boring\",\n \"dbname\": \"mydb\",\n \"engine\": \"postgres\",\n \"port\": 5432,\n \"host\": \"teststack-clustereb1186t9-sh4wpqfdyfvu.cluster-cgudolabssna.us-east-1.rds.amazonaws.com\",\n \"username\": \"myrole\"\n}\n```\n\nYou can access the secret via `role.secret`.\n\nInstead of `databaseName` you can also specify `database` to reference\nan existing database. The role will not be created until the database\nhas been created.\n\nIf you want to make the role the owner of a new database, just specify\nthe `databaseName` here, and create the database later.\n\n### IAM Authentication\n\nInstead of password-based authentication, you can create roles that use AWS IAM database authentication. This eliminates the need to store database passwords and provides enhanced security through AWS IAM policies.\n\n```ts\nimport { Role } from \"cdk-rds-sql\"\n\nconst iamRole = new Role(this, \"IamRole\", {\n provider: provider,\n roleName: \"myiamrole\",\n databaseName: \"mydb\",\n enableIamAuth: true,\n})\n```\n\nFor IAM-authenticated roles, the secret will not contain a password field:\n\n```json\n{\n \"dbClusterIdentifier\": \"teststack-clustereb1186t9-sh4wpqfdyfvu\",\n \"dbname\": \"mydb\",\n \"engine\": \"postgres\",\n \"port\": 5432,\n \"host\": \"teststack-clustereb1186t9-sh4wpqfdyfvu.cluster-cgudolabssna.us-east-1.rds.amazonaws.com\",\n \"username\": \"myiamrole\"\n}\n```\n\n**Requirements for IAM Authentication:**\n\n- SSL connections are required (enabled by default in this library)\n- Your application must have IAM permissions to connect to the database\n- The database user/role name must match the IAM identity\n\n**IAM Policy Example:**\n\nYour application will need an IAM policy like this to connect:\n\n```json\n{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Effect\": \"Allow\",\n \"Action\": [\"rds-db:connect\"],\n \"Resource\": [\n \"arn:aws:rds-db:region:account-id:dbuser:cluster-resource-id/myiamrole\"\n ]\n }\n ]\n}\n```\n\nBoth PostgreSQL and MySQL databases support IAM authentication. For more details, see the [AWS RDS IAM Database Authentication documentation](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html).\n\n### MySQL support\n\nIn MySQL users are created with '%' as value for the host. It is hard\nto do this better:\n\n- Determine the CIDR blocks used by a VPC is not trivial.\n- For imported VPCs you cannot specify the IPv6 CIDR.\n- CIDRs might change without the system knowing, meaning applications\n could lose access to the database at random times, such as when a\n container is restarted.\n\n## Database\n\nCreate a database as follows:\n\n```ts\nimport { Database } from \"cdk-rds-sql\"\n\nconst database = new Database(this, \"Database\", {\n provider: provider,\n databaseName: \"mydb\",\n})\n```\n\nYou can provide an owner, which makes it easy to create database owned\nby a new user:\n\n```ts\nconst database = new Database(this, \"Database\", {\n provider: provider,\n databaseName: \"mydb\",\n owner: role,\n})\n```\n\n## Schema\n\nCreate a schema in the default database as follows:\n\n```ts\nimport { Schema } from \"cdk-rds-sql\"\n\nnew Schema(this, \"Schema\", {\n provider: provider,\n schemaName: \"myschema\",\n})\n```\n\nOr in another database:\n\n```ts\nconst database = new Database(this, \"Database\", {\n provider: provider,\n databaseName: \"mydb\",\n})\n\nnew Schema(this, \"Schema\", {\n provider: provider,\n schemaName: \"myschema\",\n databaseName: database.databaseName,\n})\n```\n\nOne may need a role permitted for using schema:\n\n```ts\nnew Schema(this, \"Schema\", {\n provider: provider,\n schemaName: \"myschema\",\n databaseName: database.databaseName,\n role: role,\n})\n```\n\n## Sql\n\nYou can insert arbitrary SQL into your database with the `Sql` construct:\n\n```ts\nimport { Sql } from \"cdk-rds-sql\"\n\nconst sql = new Sql(this, \"Sql\", {\n provider: provider,\n database: database,\n statement: \"create table t (i int)\",\n})\n```\n\nCreate a table if it does not exist, and grant a role privileges:\n\n```ts\nconst sql = new Sql(this, \"Sql\", {\n provider: provider,\n database: database,\n statement: `\ncreate table if not exists t (i int);\ngrant select on t to myrole;\n`,\n})\n```\n\nRollback sql on stack deletion:\n\n```ts\nconst sql = new Sql(this, \"Sql\", {\n provider: provider,\n database: database,\n statement: `\ncreate table if not exists t (i int);\ngrant select on t to myrole;\n`,\n rollback: `\nDO $$BEGIN\n IF EXISTS (select from pg_database WHERE datname = 't') THEN\n IF EXISTS (select from pg_catalog.pg_roles WHERE rolname = 'myrole') THEN\n revoke select t from myrole;\n END IF;\n drop table t;\n END IF;\nEND$$;\n`,\n})\n```\n\nNote that there is no synchronisation between various `Sql`\nconstructs, in particular the order in your code does not determine\nthe order in which your SQL is executed. This happens in parallel,\nunless you specify an explicit dependency via `sql.node.addDepency()`.\n\nThere are a lot of concerns when using `Sql`:\n\n- When you update your Sql, your previous Sql is not \"rolled back\",\n the new Sql is simply executed again.\n- When you delete your `Sql` construct the rollback is executed if specified\n- When permission are granted via `Sql` they must be removed via rollback to succesfully remove the role\n- Currently the `Sql` constructs has less than 5 minutes to execute\n its work.\n- It is unknown how large your SQL can be.\n\n# Parameters\n\nSome lambda constructs, in particular [Bref](https://bref.sh/), do not\nsupport secrets out of the box. This construct allows you to create\nSSM parameters in addition to a secret:\n\n```ts\nconst role = new Role(this, \"Role\", {\n provider: provider,\n roleName: \"myrole\",\n databaseName: \"mydb\",\n parameterPrefix: \"/my-app/\",\n})\n```\n\nThis will create `/my-app/username`, `/my-app/password` and such.\n\nTo access parameters you will need IAM permissions such as:\n\n```ts\ninitialPolicy: [\n new iam.PolicyStatement({\n\tactions: [\"ssm:GetParameter\", \"ssm:GetParameters\"],\n\tresources: [\n\t // Grant access to all parameters under the base path\n\t `arn:aws:ssm:${this.region}:${this.account}:parameter/my-app/*`,\n\t],\n\teffect: iam.Effect.ALLOW,\n })\n],\n```\n\nNote that your VPC will need an SSM Parameters interface endpoint to support this.\n\n# IPv6\n\nIf you use the provider in an IPv6 subnet you probably need these settings:\n\n```ts\nimport { Provider } from \"cdk-rds-sql\"\n\nconst provider = new Provider(this, \"Provider\", {\n ...\n functionProps: {\n\tipv6AllowedForDualStack: true,\n\tallowAllIpv6Outbound: true,\n },\n}\n```\n\n# Working on this code\n\nThis code is managed by\n[projen](https://github.com/projen/projen/blob/main/README.md). In\naddition [pre-commit](https://pre-commit.com/) is used.\n\nSo after git clone and `npm ci` you would do:\n\n```\npre-commit install --install-hooks --hook-type commit-msg --hook-type pre-commit\n```\n\nto install the pre-commit hooks.\n\n## Testing\n\nTest code via projen with:\n\n npx projen test\n\nYou can run the sample stack with:\n\n npx projen integ:deploy:serverless\n\nIf you want to use an existing vpc:\n\n npx cdk deploy --context vpc-id=vpc-0123456789 TestServerlessV2Stack\n\n# To do\n\n- Update role: will not revoke connect to previous database if database name has changed.\n"
3978
+ "markdown": "# About\n\nThis CDK construct library makes it possible to create databases,\nschemas, and roles in an Aurora Serverless v2, RDS Database Cluster or\nDatabase Instance. Both PostgreSQL and MySQL databases are supported.\n\nThis construct library is intended to be used in enterprise\nenvironments, and works in isolated subnets.\n\n<p align=\"left\">\n <a href=\"https://github.com/semantic-release/semantic-release\"><img src=\"https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release\" alt=semantic-release: angular\"></a>\n <a href=\"https://github.com/berenddeboer/cdk-rds-sql/actions/workflows/release.yml\"><img src=\"https://github.com/berenddeboer/cdk-rds-sql/actions/workflows/release.yml/badge.svg\" alt=\"Release badge\"></a>\n</p>\n\n# Requirements\n\n- CDK v2.\n\n# Installation\n\n npm i cdk-rds-sql\n\n# Usage\n\n## Provider\n\nFirst setup your VPC and create your cluster:\n\n```ts\nimport { Duration, RemovalPolicy } from \"aws-cdk-lib\"\nimport * as ec2 from \"aws-cdk-lib/aws-ec2\"\nimport * as rds from \"aws-cdk-lib/aws-rds\"\n\nconst vpc = ec2.Vpc.fromLookup(this, \"Vpc\", {\n vpcId: this.node.tryGetContext(\"vpc-id\"),\n})\n\nconst cluster = new rds.ServerlessCluster(this, \"Cluster\", {\n vpc: vpc,\n vpcSubnets: {\n subnetType: ec2.SubnetType.PRIVATE_ISOLATED,\n },\n engine: rds.DatabaseClusterEngine.AURORA_POSTGRESQL,\n parameterGroup: rds.ParameterGroup.fromParameterGroupName(\n this,\n \"ParameterGroup\",\n \"default.aurora-postgresql11\"\n ),\n removalPolicy: RemovalPolicy.DESTROY,\n scaling: {\n autoPause: Duration.minutes(60),\n minCapacity: rds.AuroraCapacityUnit.ACU_2,\n maxCapacity: rds.AuroraCapacityUnit.ACU_2,\n },\n})\n```\n\nThen create a provider which will connect to your database. For a cluster:\n\n```ts\nimport { Provider } from \"cdk-rds-sql\"\n\nconst provider = new Provider(this, \"Provider\", {\n vpc: vpc,\n cluster: cluster,\n secret: cluster.secret!,\n})\n```\n\nFor an instance:\n\n```ts\nimport { Provider } from \"cdk-rds-sql\"\n\nconst provider = new Provider(this, \"Provider\", {\n vpc: vpc,\n instance: instance,\n secret: cluster.secret!,\n})\n```\n\nThe provider will setup a lambda, which normally lives in the same VPC\nas the database. You can give a different VPC, as long as that VPC has\naccess to the VPC of the database. Only the provider lambda will talk\nto your database.\n\nThe provider will by default use the private isolated subnet of the\nVPC. Your isolated network must have a VPC endpoint to AWS Secrets Manager\nand possibly KMS as well. If you want to use a subnet with egress\naccess in case you have no such VPC endpoints, specify the subnet as\nfollows:\n\n```ts\nimport { Provider } from \"cdk-rds-sql\"\n\nconst provider = new Provider(this, \"Provider\", {\n vpc: vpc,\n vpcSubnets: {\n subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS,\n },\n cluster: cluster,\n secret: cluster.secret!,\n})\n```\n\n### Disabling SSL\n\nThe default connection to RDS is ssl enabled (this used to be disabled\nin versions below 4).\n\nYou can disable ssl by setting the `ssl` option to `false`:\n\n```ts\nconst provider = new Provider(this, \"Provider\", {\n vpc: vpc,\n instance: instance,\n secret: cluster.secret!,\n ssl: false, // default is true\n})\n```\n\n## Roles\n\nCreate a postgres role (or mysql user) for a cluster as follows:\n\n```ts\nimport { Role } from \"cdk-rds-sql\"\n\nconst role = new Role(this, \"Role\", {\n provider: provider,\n roleName: \"myrole\",\n databaseName: \"mydb\",\n})\n```\n\nThis will automatically create a secret just like `ServerlessCluster`\ndoes, with all the connection info needed for this user. It's secret value is a JSON like:\n\n```json\n{\n \"dbClusterIdentifier\": \"teststack-clustereb1186t9-sh4wpqfdyfvu\",\n \"password\": \"very-long-and-boring\",\n \"dbname\": \"mydb\",\n \"engine\": \"postgres\",\n \"port\": 5432,\n \"host\": \"teststack-clustereb1186t9-sh4wpqfdyfvu.cluster-cgudolabssna.us-east-1.rds.amazonaws.com\",\n \"username\": \"myrole\"\n}\n```\n\nYou can access the secret via `role.secret`.\n\nInstead of `databaseName` you can also specify `database` to reference\nan existing database. The role will not be created until the database\nhas been created.\n\nIf you want to make the role the owner of a new database, just specify\nthe `databaseName` here, and create the database later.\n\n### IAM Authentication\n\nInstead of password-based authentication, you can create roles that\nuse AWS IAM database authentication. This eliminates the need to store\ndatabase passwords and provides enhanced security through AWS IAM\npolicies.\n\n```ts\nimport { Role } from \"cdk-rds-sql\"\n\nconst iamRole = new Role(this, \"IamRole\", {\n provider: provider,\n roleName: \"myiamrole\",\n databaseName: \"mydb\",\n enableIamAuth: true,\n})\n```\n\nFor IAM-authenticated roles, the secret will not contain a password field:\n\n```json\n{\n \"dbClusterIdentifier\": \"teststack-clustereb1186t9-sh4wpqfdyfvu\",\n \"dbname\": \"mydb\",\n \"engine\": \"postgres\",\n \"port\": 5432,\n \"host\": \"teststack-clustereb1186t9-sh4wpqfdyfvu.cluster-cgudolabssna.us-east-1.rds.amazonaws.com\",\n \"username\": \"myiamrole\"\n}\n```\n\n**Requirements for IAM Authentication:**\n\n- SSL connections are required (enabled by default in this library)\n- Your application must have IAM permissions to connect to the database\n- The database user/role name must match the IAM identity\n\n**IAM Policy Example:**\n\nYour application will need an IAM policy like this to connect:\n\n```json\n{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Effect\": \"Allow\",\n \"Action\": [\"rds-db:connect\"],\n \"Resource\": [\n \"arn:aws:rds-db:region:account-id:dbuser:cluster-resource-id/myiamrole\"\n ]\n }\n ]\n}\n```\n\nBoth PostgreSQL and MySQL databases support IAM authentication. For more details, see the [AWS RDS IAM Database Authentication documentation](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html).\n\n### MySQL support\n\nIn MySQL users are created with '%' as value for the host. It is hard\nto do this better:\n\n- Determine the CIDR blocks used by a VPC is not trivial.\n- For imported VPCs you cannot specify the IPv6 CIDR.\n- CIDRs might change without the system knowing, meaning applications\n could lose access to the database at random times, such as when a\n container is restarted.\n\n## Database\n\nCreate a database as follows:\n\n```ts\nimport { Database } from \"cdk-rds-sql\"\n\nconst database = new Database(this, \"Database\", {\n provider: provider,\n databaseName: \"mydb\",\n})\n```\n\nYou can provide an owner, which makes it easy to create database owned\nby a new user:\n\n```ts\nconst database = new Database(this, \"Database\", {\n provider: provider,\n databaseName: \"mydb\",\n owner: role,\n})\n```\n\n## Schema\n\nCreate a schema in the default database as follows:\n\n```ts\nimport { Schema } from \"cdk-rds-sql\"\n\nnew Schema(this, \"Schema\", {\n provider: provider,\n schemaName: \"myschema\",\n})\n```\n\nOr in another database:\n\n```ts\nconst database = new Database(this, \"Database\", {\n provider: provider,\n databaseName: \"mydb\",\n})\n\nnew Schema(this, \"Schema\", {\n provider: provider,\n schemaName: \"myschema\",\n databaseName: database.databaseName,\n})\n```\n\nOne may need a role permitted for using schema:\n\n```ts\nnew Schema(this, \"Schema\", {\n provider: provider,\n schemaName: \"myschema\",\n databaseName: database.databaseName,\n role: role,\n})\n```\n\n## Sql\n\nYou can insert arbitrary SQL into your database with the `Sql` construct:\n\n```ts\nimport { Sql } from \"cdk-rds-sql\"\n\nconst sql = new Sql(this, \"Sql\", {\n provider: provider,\n database: database,\n statement: \"create table t (i int)\",\n})\n```\n\nCreate a table if it does not exist, and grant a role privileges:\n\n```ts\nconst sql = new Sql(this, \"Sql\", {\n provider: provider,\n database: database,\n statement: `\ncreate table if not exists t (i int);\ngrant select on t to myrole;\n`,\n})\n```\n\nRollback sql on stack deletion:\n\n```ts\nconst sql = new Sql(this, \"Sql\", {\n provider: provider,\n database: database,\n statement: `\ncreate table if not exists t (i int);\ngrant select on t to myrole;\n`,\n rollback: `\nDO $$BEGIN\n IF EXISTS (select from pg_database WHERE datname = 't') THEN\n IF EXISTS (select from pg_catalog.pg_roles WHERE rolname = 'myrole') THEN\n revoke select t from myrole;\n END IF;\n drop table t;\n END IF;\nEND$$;\n`,\n})\n```\n\nNote that there is no synchronisation between various `Sql`\nconstructs, in particular the order in your code does not determine\nthe order in which your SQL is executed. This happens in parallel,\nunless you specify an explicit dependency via `sql.node.addDepency()`.\n\nThere are a lot of concerns when using `Sql`:\n\n- When you update your Sql, your previous Sql is not \"rolled back\",\n the new Sql is simply executed again.\n- When you delete your `Sql` construct the rollback is executed if specified\n- When permission are granted via `Sql` they must be removed via\n rollback to succesfully remove the role\n- Currently the `Sql` constructs has less than 5 minutes to execute\n its work.\n- It is unknown how large your SQL can be.\n\n# Parameters\n\nSome lambda constructs, in particular [Bref](https://bref.sh/), do not\nsupport secrets out of the box. Use the `parameterPrefix` property to\ncreate SSM parameters in addition to a secret:\n\n```ts\nconst role = new Role(this, \"Role\", {\n provider: provider,\n roleName: \"myrole\",\n databaseName: \"mydb\",\n parameterPrefix: \"/my-app/\",\n})\n```\n\nThis will create `/my-app/username`, `/my-app/password` and such.\n\nTo access parameters you will need IAM permissions such as:\n\n```ts\ninitialPolicy: [\n new iam.PolicyStatement({\n\tactions: [\"ssm:GetParameter\", \"ssm:GetParameters\"],\n\tresources: [\n\t // Grant access to all parameters under the base path\n\t `arn:aws:ssm:${this.region}:${this.account}:parameter/my-app/*`,\n\t],\n\teffect: iam.Effect.ALLOW,\n })\n],\n```\n\nNote that your VPC will need an SSM Parameters interface endpoint to support this.\n\n# IPv6\n\nIf you use the provider in an IPv6 subnet you probably need these settings:\n\n```ts\nimport { Provider } from \"cdk-rds-sql\"\n\nconst provider = new Provider(this, \"Provider\", {\n ...\n functionProps: {\n\tipv6AllowedForDualStack: true,\n\tallowAllIpv6Outbound: true,\n },\n}\n```\n\n# Working on this code\n\nThis code is managed by\n[projen](https://github.com/projen/projen/blob/main/README.md). In\naddition [pre-commit](https://pre-commit.com/) is used.\n\nSo after git clone and `npm ci` you would do:\n\n```\npre-commit install --install-hooks --hook-type commit-msg --hook-type pre-commit\n```\n\nto install the pre-commit hooks.\n\n## Testing\n\nTest code via projen with:\n\n npx projen test\n\nYou can run the sample stack with:\n\n npx projen integ:deploy:serverless\n\nIf you want to use an existing vpc:\n\n npx cdk deploy --context vpc-id=vpc-0123456789 TestServerlessV2Stack\n\n# To do\n\n- Update role: will not revoke connect to previous database if database name has changed.\n"
3979
3979
  },
3980
3980
  "repository": {
3981
3981
  "type": "git",
@@ -5078,6 +5078,6 @@
5078
5078
  "symbolId": "src/sql:SqlProps"
5079
5079
  }
5080
5080
  },
5081
- "version": "6.1.4",
5082
- "fingerprint": "gGYE5uGKDGi/K2b4lQzuqFQWbFvHPjSKo1t8yjvmfhY="
5081
+ "version": "7.0.0",
5082
+ "fingerprint": "+i9UU38nhZnbfVLfh/muft/3rjnKix5gV2bTOvCnBSY="
5083
5083
  }
@@ -56,5 +56,5 @@ repos:
56
56
  exclude: .projenrc.ts
57
57
  name: test
58
58
  language: system
59
- entry: sh -c 'npx projen test --coverage=false'
59
+ entry: sh -c 'npx jest --coverage=false'
60
60
  files: \.ts$
package/README.md CHANGED
@@ -159,7 +159,10 @@ the `databaseName` here, and create the database later.
159
159
 
160
160
  ### IAM Authentication
161
161
 
162
- Instead of password-based authentication, you can create roles that use AWS IAM database authentication. This eliminates the need to store database passwords and provides enhanced security through AWS IAM policies.
162
+ Instead of password-based authentication, you can create roles that
163
+ use AWS IAM database authentication. This eliminates the need to store
164
+ database passwords and provides enhanced security through AWS IAM
165
+ policies.
163
166
 
164
167
  ```ts
165
168
  import { Role } from "cdk-rds-sql"
@@ -346,7 +349,8 @@ There are a lot of concerns when using `Sql`:
346
349
  - When you update your Sql, your previous Sql is not "rolled back",
347
350
  the new Sql is simply executed again.
348
351
  - When you delete your `Sql` construct the rollback is executed if specified
349
- - When permission are granted via `Sql` they must be removed via rollback to succesfully remove the role
352
+ - When permission are granted via `Sql` they must be removed via
353
+ rollback to succesfully remove the role
350
354
  - Currently the `Sql` constructs has less than 5 minutes to execute
351
355
  its work.
352
356
  - It is unknown how large your SQL can be.
@@ -354,8 +358,8 @@ There are a lot of concerns when using `Sql`:
354
358
  # Parameters
355
359
 
356
360
  Some lambda constructs, in particular [Bref](https://bref.sh/), do not
357
- support secrets out of the box. This construct allows you to create
358
- SSM parameters in addition to a secret:
361
+ support secrets out of the box. Use the `parameterPrefix` property to
362
+ create SSM parameters in addition to a secret:
359
363
 
360
364
  ```ts
361
365
  const role = new Role(this, "Role", {
@@ -84,7 +84,12 @@ export abstract class AbstractEngine {
84
84
  */
85
85
  protected async getPassword(arn: string): Promise<string | void> {
86
86
  if (!arn) return
87
- const secrets_client = new SecretsManagerClient({})
87
+ const secrets_client = new SecretsManagerClient({
88
+ requestHandler: {
89
+ connectionTimeout: 5000,
90
+ requestTimeout: 10000,
91
+ },
92
+ })
88
93
  const command = new GetSecretValueCommand({
89
94
  SecretId: arn,
90
95
  })
package/lib/database.js CHANGED
@@ -40,5 +40,5 @@ class Database extends aws_cdk_lib_1.CustomResource {
40
40
  }
41
41
  exports.Database = Database;
42
42
  _a = JSII_RTTI_SYMBOL_1;
43
- Database[_a] = { fqn: "cdk-rds-sql.Database", version: "6.1.4" };
43
+ Database[_a] = { fqn: "cdk-rds-sql.Database", version: "7.0.0" };
44
44
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0YWJhc2UuanMiLCJzb3Vy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