@aws/nx-plugin-mcp 1.0.0-rc.32 → 1.0.0-rc.34

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.
Files changed (34) hide show
  1. package/bin/aws-nx-mcp.js +1444 -1348
  2. package/docs/guides/connection/py-agent-rdb.mdx +162 -0
  3. package/docs/guides/connection/py-fast-api-rdb.mdx +170 -0
  4. package/docs/guides/connection/py-mcp-server-rdb.mdx +171 -0
  5. package/docs/guides/connection/smithy-rdb.mdx +1 -1
  6. package/docs/guides/connection/trpc-rdb.mdx +1 -1
  7. package/docs/guides/connection/ts-agent-rdb.mdx +45 -16
  8. package/docs/guides/connection/ts-mcp-server-rdb.mdx +45 -11
  9. package/docs/guides/connection.mdx +28 -1
  10. package/docs/guides/py-rdb.mdx +250 -0
  11. package/docs/guides/ts-rdb.mdx +48 -483
  12. package/docs/snippets/connection/py-lambda-rdb-ssl-requirements.mdx +7 -0
  13. package/docs/snippets/connection/rdb-api-infrastructure.mdx +36 -15
  14. package/docs/snippets/rdb/architecture.mdx +38 -0
  15. package/docs/snippets/rdb/cluster-instances.mdx +31 -0
  16. package/docs/snippets/rdb/deletion-protection.mdx +34 -0
  17. package/docs/snippets/rdb/deploying.mdx +107 -0
  18. package/docs/snippets/rdb/encryption-key-rotation.mdx +30 -0
  19. package/docs/snippets/rdb/engine-version.mdx +63 -0
  20. package/docs/snippets/rdb/infrastructure.mdx +35 -0
  21. package/docs/snippets/rdb/logging.mdx +32 -0
  22. package/docs/snippets/rdb/rds-proxy.mdx +50 -0
  23. package/docs/snippets/rdb/removal-policy.mdx +57 -0
  24. package/docs/snippets/rdb/serverless-capacity.mdx +32 -0
  25. package/generators.json +27 -0
  26. package/package.json +1 -1
  27. package/src/preset/schema.json +6 -0
  28. package/src/py/rdb/agent-connection/schema.json +27 -0
  29. package/src/py/rdb/fast-api-connection/schema.json +23 -0
  30. package/src/py/rdb/mcp-server-connection/schema.json +27 -0
  31. package/src/py/rdb/schema.json +77 -0
  32. package/src/ts/rdb/schema.json +1 -1
  33. /package/docs/snippets/connection/{lambda-rdb-ssl-requirements.mdx → ts-lambda-rdb-ssl-requirements.mdx} +0 -0
  34. /package/docs/snippets/connection/{mcp-server-rdb-ssl-requirements.mdx → ts-mcp-server-rdb-ssl-requirements.mdx} +0 -0
@@ -2,6 +2,7 @@
2
2
  title: RDB API Infrastructure
3
3
  ---
4
4
  import Infrastructure from '@components/infrastructure.astro';
5
+ import Link from '@components/link.astro';
5
6
 
6
7
  To allow your API to connect to the database at runtime, the API Lambda functions must be deployed into the same VPC as the database and granted network and IAM access.
7
8
 
@@ -39,7 +40,7 @@ This example grants every handler in your API access, but if only some handlers
39
40
  </Fragment>
40
41
  <Fragment slot="terraform">
41
42
 
42
- Pass the database module outputs into your API module so it can reach the database and read its runtime configuration:
43
+ Deploy the API into the same VPC as the database, grant it `rds-db:connect` via `additional_iam_policy_statements`, and open the network path with a pair of security group rules:
43
44
 
44
45
  ```hcl title="packages/infra/src/main.tf"
45
46
  module "my_database" {
@@ -50,24 +51,44 @@ module "my_database" {
50
51
  }
51
52
 
52
53
  module "api" {
53
- source = "..."
54
- enable_vpc = true
55
- vpc_id = module.vpc.vpc_id
56
- private_subnet_ids = module.vpc.private_subnet_ids
57
-
58
- appconfig_application_id = module.my_database.appconfig_application_id
59
- database_cluster_resource_id = module.my_database.cluster_resource_id
60
- database_runtime_user = module.my_database.database_runtime_user
61
- database_security_group_id = module.my_database.security_group_id
62
- database_port = module.my_database.cluster_port
63
-
64
- environment_variables = {
65
- RUNTIME_CONFIG_APP_ID = module.my_database.appconfig_application_id
54
+ source = "..."
55
+ enable_vpc = true
56
+ vpc_id = module.vpc.vpc_id
57
+ subnet_ids = module.vpc.private_subnet_ids
58
+
59
+ additional_iam_policy_statements = [
60
+ {
61
+ Effect = "Allow"
62
+ Action = ["rds-db:connect"]
63
+ Resource = [
64
+ "arn:aws:rds-db:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:dbuser:${module.my_database.connect_resource_id}/${module.my_database.database_runtime_user}"
65
+ ]
66
+ }
67
+ ]
68
+
69
+ env = {
70
+ RUNTIME_CONFIG_APP_ID = module.runtime_config_appconfig.application_id
66
71
  }
67
72
  }
73
+
74
+ resource "aws_vpc_security_group_ingress_rule" "api_to_database" {
75
+ security_group_id = module.my_database.security_group_id
76
+ referenced_security_group_id = module.api.security_group_id
77
+ from_port = module.my_database.cluster_port
78
+ to_port = module.my_database.cluster_port
79
+ ip_protocol = "tcp"
80
+ }
81
+
82
+ resource "aws_vpc_security_group_egress_rule" "api_to_database" {
83
+ security_group_id = module.api.security_group_id
84
+ referenced_security_group_id = module.my_database.security_group_id
85
+ from_port = module.my_database.cluster_port
86
+ to_port = module.my_database.cluster_port
87
+ ip_protocol = "tcp"
88
+ }
68
89
  ```
69
90
 
70
- Deploy the API Lambda functions into **private subnets with egress**, not private isolated subnets. Ensure the API Lambda role has `rds-db:connect` permission and that its security group can reach the database security group on the database port.
91
+ Deploy the API Lambda functions into **private subnets with egress**, not private isolated subnets. `RUNTIME_CONFIG_APP_ID` should point at the shared <Link path="guides/runtime-config">runtime configuration</Link> AppConfig application, not an output of the database module.
71
92
 
72
93
  </Fragment>
73
94
  </Infrastructure>
@@ -0,0 +1,38 @@
1
+ ---
2
+ title: RDB Architecture
3
+ ---
4
+
5
+ The deployed database has the following architecture. By default, an [Amazon RDS Proxy](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy.html) sits in front of the Aurora cluster to pool connections and to enable [IAM authentication](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html) — see [Disable RDS Proxy](#disable-rds-proxy) for the alternative. The architecture is the same whether you select the PostgreSQL or MySQL engine; only the Aurora engine flavor differs.
6
+
7
+ ```d2 inline=true
8
+ direction: right
9
+
10
+ app: Application\n(Lambda, Agent, ...) {
11
+ shape: hexagon
12
+ }
13
+
14
+ proxy: RDS Proxy {
15
+ shape: image
16
+ icon: /nx-plugin-for-aws/icons/aws/rds.svg
17
+ }
18
+
19
+ migrations: Migrations Lambda {
20
+ shape: image
21
+ icon: /nx-plugin-for-aws/icons/aws/lambda.svg
22
+ }
23
+
24
+ aurora: Aurora\n(PostgreSQL or MySQL) {
25
+ shape: image
26
+ icon: /nx-plugin-for-aws/icons/aws/aurora.svg
27
+ }
28
+
29
+ secrets: Secrets Manager\n(DB credentials) {
30
+ shape: image
31
+ icon: /nx-plugin-for-aws/icons/aws/secrets-manager.svg
32
+ }
33
+
34
+ app -> proxy: SQL (IAM auth)
35
+ proxy -> aurora
36
+ migrations -> aurora: Schema migrations
37
+ migrations -> secrets: Admin credentials
38
+ ```
@@ -0,0 +1,31 @@
1
+ ---
2
+ title: Cluster Instances
3
+ ---
4
+ import Infrastructure from '@components/infrastructure.astro';
5
+
6
+ Configure the writer and reader instances for your Aurora cluster.
7
+
8
+ <Infrastructure>
9
+ <Fragment slot="cdk">
10
+
11
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
12
+ import { MyDatabase } from ':my-scope/common-constructs';
13
+
14
+ const db = new MyDatabase(this, 'Db', {
15
+ ...
16
+ writer: ClusterInstance.serverlessV2('writer'),
17
+ readers: [ClusterInstance.serverlessV2('reader')],
18
+ });
19
+ ```
20
+ </Fragment>
21
+ <Fragment slot="terraform">
22
+
23
+ ```hcl title="packages/infra/src/main.tf"
24
+ module "my_database" {
25
+ source = "../../common/terraform/src/app/dbs/my-database"
26
+ ...
27
+ instance_count = 2 # 1 writer + 1 reader
28
+ }
29
+ ```
30
+ </Fragment>
31
+ </Infrastructure>
@@ -0,0 +1,34 @@
1
+ ---
2
+ title: Deletion Protection
3
+ ---
4
+ import Infrastructure from '@components/infrastructure.astro';
5
+
6
+ Deletion protection is enabled by default (`deletionProtection: true` in CDK, `deletion_protection = true` in Terraform) to protect the Aurora cluster from accidental deletion.
7
+
8
+ #### Disable Deletion Protection
9
+
10
+ You can disable deletion protection for environments where database deletion is expected, such as short-lived development or preview stacks.
11
+
12
+ <Infrastructure>
13
+ <Fragment slot="cdk">
14
+
15
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
16
+ import { MyDatabase } from ':my-scope/common-constructs';
17
+
18
+ const db = new MyDatabase(this, 'Db', {
19
+ ...
20
+ deletionProtection: false,
21
+ });
22
+ ```
23
+ </Fragment>
24
+ <Fragment slot="terraform">
25
+
26
+ ```hcl title="packages/infra/src/main.tf"
27
+ module "my_database" {
28
+ source = "../../common/terraform/src/app/dbs/my-database"
29
+ ...
30
+ deletion_protection = false
31
+ }
32
+ ```
33
+ </Fragment>
34
+ </Infrastructure>
@@ -0,0 +1,107 @@
1
+ ---
2
+ title: Deploying your Relational Database
3
+ ---
4
+ import Infrastructure from '@components/infrastructure.astro';
5
+ import Link from '@components/link.astro';
6
+
7
+ The relational database generator creates CDK or Terraform infrastructure based on your selected `iacProvider`.
8
+
9
+ <Infrastructure>
10
+ <Fragment slot="cdk">
11
+ The CDK construct is created in `common/constructs`. Example usage:
12
+
13
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
14
+ import { MyDatabase } from ':my-scope/common-constructs';
15
+
16
+ export class ApplicationStack extends Stack {
17
+ constructor(scope: Construct, id: string, props?: StackProps) {
18
+ super(scope, id, props);
19
+ ...
20
+ const db = new MyDatabase(this, 'Db', {
21
+ vpc,
22
+ vpcSubnets: {
23
+ subnetType: SubnetType.PRIVATE_ISOLATED,
24
+ }
25
+ });
26
+ }
27
+ }
28
+ ```
29
+
30
+ This provisions an Aurora cluster with RDS Proxy, admin credentials, application database user, runtime config registration, and migration handler.
31
+
32
+ The generated infrastructure creates two database users:
33
+ - **Admin user** - Created during cluster provisioning with credentials stored in AWS Secrets Manager
34
+ - **Application user** - Created via a Lambda custom resource with IAM authentication enabled and DML privileges (SELECT, INSERT, UPDATE, DELETE) on the application database
35
+ </Fragment>
36
+ <Fragment slot="terraform">
37
+ The Terraform module is created in `common/terraform`. Example usage:
38
+
39
+ ```hcl title="packages/infra/src/main.tf"
40
+ module "my_database" {
41
+ source = "../../common/terraform/src/app/dbs/my-database"
42
+
43
+ vpc_id = module.vpc.vpc_id
44
+ database_subnet_ids = module.vpc.private_isolated_subnet_ids
45
+ lambda_subnet_ids = module.vpc.private_subnet_ids
46
+
47
+ tags = local.common_tags
48
+ }
49
+ ```
50
+
51
+ This provisions an Aurora cluster with RDS Proxy, admin credentials, create-db-user Lambda, runtime config registration, migration Lambda, and container registry resources.
52
+
53
+ The generated infrastructure creates two database users:
54
+ - **Admin user** - Created during cluster provisioning with credentials stored in AWS Secrets Manager
55
+ - **Application user** - Created via a Lambda function with IAM authentication enabled and DML privileges (SELECT, INSERT, UPDATE, DELETE) on the application database
56
+ </Fragment>
57
+ </Infrastructure>
58
+
59
+ The application user is automatically created with a random name and IAM authentication. The generated database client is already configured to authenticate as this user using short-lived RDS tokens, so your application code never handles database passwords.
60
+
61
+ Your VPC should include public subnets, private subnets with egress, and private isolated subnets. The database can run in private isolated subnets, while application Lambda functions should run in private subnets with egress so they can reach AWS services such as AppConfig.
62
+
63
+ <Infrastructure>
64
+ <Fragment slot="cdk">
65
+
66
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
67
+ const vpc = new Vpc(this, 'Vpc', {
68
+ subnetConfiguration: [
69
+ {
70
+ name: 'public',
71
+ subnetType: SubnetType.PUBLIC,
72
+ },
73
+ {
74
+ name: 'private_with_egress',
75
+ subnetType: SubnetType.PRIVATE_WITH_EGRESS,
76
+ },
77
+ {
78
+ name: 'private_isolated',
79
+ subnetType: SubnetType.PRIVATE_ISOLATED,
80
+ },
81
+ ],
82
+ });
83
+ ```
84
+
85
+ </Fragment>
86
+ <Fragment slot="terraform">
87
+
88
+ ```hcl title="packages/infra/src/main.tf"
89
+ module "vpc" {
90
+ source = "terraform-aws-modules/vpc/aws"
91
+ version = "~> 6.0"
92
+
93
+ name = "app"
94
+ ...
95
+ public_subnet_names = ["public"]
96
+ private_subnet_names = ["private_with_egress"]
97
+ intra_subnet_names = ["private_isolated"]
98
+
99
+ enable_nat_gateway = true
100
+ single_nat_gateway = true
101
+ }
102
+ ```
103
+
104
+ </Fragment>
105
+ </Infrastructure>
106
+
107
+ Use the <Link path="guides/connection">`connection`</Link> generator to connect a project to this database — see the connection guide for the relevant compute type (e.g. FastAPI, MCP server, agent) for the infrastructure wiring required to reach it.
@@ -0,0 +1,30 @@
1
+ ---
2
+ title: Encryption Key Rotation
3
+ ---
4
+ import Infrastructure from '@components/infrastructure.astro';
5
+
6
+ The KMS key used to encrypt the Aurora cluster and its credentials secret has automatic key rotation enabled by default. Disable it if your security policy manages rotation externally.
7
+
8
+ <Infrastructure>
9
+ <Fragment slot="cdk">
10
+
11
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
12
+ import { MyDatabase } from ':my-scope/common-constructs';
13
+
14
+ const db = new MyDatabase(this, 'Db', {
15
+ ...
16
+ enableKeyRotation: false,
17
+ });
18
+ ```
19
+ </Fragment>
20
+ <Fragment slot="terraform">
21
+
22
+ ```hcl title="packages/infra/src/main.tf"
23
+ module "my_database" {
24
+ source = "../../common/terraform/src/app/dbs/my-database"
25
+ ...
26
+ enable_key_rotation = false
27
+ }
28
+ ```
29
+ </Fragment>
30
+ </Infrastructure>
@@ -0,0 +1,63 @@
1
+ ---
2
+ title: Engine Version
3
+ ---
4
+ import Infrastructure from '@components/infrastructure.astro';
5
+ import OptionFilter from '@components/option-filter.astro';
6
+
7
+ Pin a specific Aurora engine version.
8
+
9
+ By default, the generated local database container image matches the default Aurora engine version. If you change the Aurora engine version, it's recommended to also use a matching local container image version for maximum compatibility. See the AWS release notes for [Aurora PostgreSQL versions](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraPostgreSQLReleaseNotes/aurorapostgresql-release-calendar.html) and [Aurora MySQL versions](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraMySQLReleaseNotes/AuroraMySQL.Updates.30Updates.html) to identify the corresponding community database version.
10
+
11
+ The local database image is configured in the `localDev.image` field of the generated `config.json` file in your database project root. Update that value when you change engine versions.
12
+
13
+ <OptionFilter when={{ engine: 'postgres' }}>
14
+ <Infrastructure>
15
+ <Fragment slot="cdk">
16
+
17
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
18
+ import { MyDatabase } from ':my-scope/common-constructs';
19
+
20
+ const db = new MyDatabase(this, 'Db', {
21
+ ...
22
+ engineVersion: AuroraPostgresEngineVersion.VER_17_7,
23
+ });
24
+ ```
25
+ </Fragment>
26
+ <Fragment slot="terraform">
27
+
28
+ ```hcl title="packages/infra/src/main.tf"
29
+ module "my_database" {
30
+ source = "../../common/terraform/src/app/dbs/my-database"
31
+ ...
32
+ engine_version = "17.7"
33
+ }
34
+ ```
35
+ </Fragment>
36
+ </Infrastructure>
37
+ </OptionFilter>
38
+
39
+ <OptionFilter when={{ engine: 'mysql' }}>
40
+ <Infrastructure>
41
+ <Fragment slot="cdk">
42
+
43
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
44
+ import { MyDatabase } from ':my-scope/common-constructs';
45
+
46
+ const db = new MyDatabase(this, 'Db', {
47
+ ...
48
+ engineVersion: AuroraMysqlEngineVersion.VER_3_12_0,
49
+ });
50
+ ```
51
+ </Fragment>
52
+ <Fragment slot="terraform">
53
+
54
+ ```hcl title="packages/infra/src/main.tf"
55
+ module "my_database" {
56
+ source = "../../common/terraform/src/app/dbs/my-database"
57
+ ...
58
+ engine_version = "8.0.mysql_aurora.3.12.0"
59
+ }
60
+ ```
61
+ </Fragment>
62
+ </Infrastructure>
63
+ </OptionFilter>
@@ -0,0 +1,35 @@
1
+ ---
2
+ title: RDB Infrastructure
3
+ ---
4
+ import { FileTree } from '@astrojs/starlight/components';
5
+ import Infrastructure from '@components/infrastructure.astro';
6
+ import Snippet from '@components/snippet.astro';
7
+
8
+ <Snippet name="shared-constructs" />
9
+
10
+ <Infrastructure>
11
+ <Fragment slot="cdk">
12
+ <FileTree>
13
+ - packages/common/constructs/src
14
+ - app
15
+ - dbs
16
+ - \<name>.ts Infrastructure specific to your database
17
+ - core
18
+ - rdb
19
+ - aurora.ts Generic Aurora database construct
20
+ </FileTree>
21
+ </Fragment>
22
+ <Fragment slot="terraform">
23
+ <FileTree>
24
+ - packages/common/terraform/src
25
+ - app
26
+ - dbs
27
+ - \<name>
28
+ - \<name>.tf Module specific to your database
29
+ - core
30
+ - rdb
31
+ - aurora
32
+ - aurora.tf Generic Aurora module
33
+ </FileTree>
34
+ </Fragment>
35
+ </Infrastructure>
@@ -0,0 +1,32 @@
1
+ ---
2
+ title: Logging and Monitoring
3
+ ---
4
+ import Infrastructure from '@components/infrastructure.astro';
5
+
6
+ Performance Insights is enabled on the Aurora writer instance by default (encrypted with the cluster's KMS key). You can also export the Aurora engine logs to [CloudWatch Logs](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_LogAccess.html) (`postgresql` for [Aurora PostgreSQL](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.CloudWatch.html); `audit`, `error`, `general` and `slowquery` for [Aurora MySQL](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Integrating.CloudWatch.html)). Enable log export per database:
7
+
8
+ <Infrastructure>
9
+ <Fragment slot="cdk">
10
+
11
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
12
+ import { MyDatabase } from ':my-scope/common-constructs';
13
+
14
+ const db = new MyDatabase(this, 'Db', {
15
+ ...
16
+ enableCloudwatchLogs: true,
17
+ enablePerformanceInsights: false, // disable if not required
18
+ });
19
+ ```
20
+ </Fragment>
21
+ <Fragment slot="terraform">
22
+
23
+ ```hcl title="packages/infra/src/main.tf"
24
+ module "my_database" {
25
+ source = "../../common/terraform/src/app/dbs/my-database"
26
+ ...
27
+ enable_cloudwatch_logs = true
28
+ enable_performance_insights = false # disable if not required
29
+ }
30
+ ```
31
+ </Fragment>
32
+ </Infrastructure>
@@ -0,0 +1,50 @@
1
+ ---
2
+ title: RDS Proxy Configuration
3
+ ---
4
+ import Infrastructure from '@components/infrastructure.astro';
5
+
6
+ The generated infrastructure includes an [RDS Proxy](https://aws.amazon.com/rds/proxy/) by default, which sits between your application and the Aurora cluster. RDS Proxy provides several benefits:
7
+
8
+ - **Connection pooling** - Maintains a pool of database connections that can be shared across application instances, reducing the overhead of establishing new connections
9
+ - **Connection resilience** - Automatically handles failovers and reconnects during Aurora instance replacements or maintenance
10
+ - **IAM authentication** - Supports IAM-based database authentication, eliminating the need to manage database credentials in your application code
11
+ - **Improved security** - Enforces TLS encryption for all connections
12
+
13
+ :::note[Additional Cost]
14
+ RDS Proxy is enabled by default but incurs additional charges on top of the Aurora cluster cost. See [AWS RDS Proxy pricing](https://aws.amazon.com/rds/proxy/pricing/) for details. If you would prefer to disable the proxy, see the section below.
15
+ :::
16
+
17
+ #### Disable RDS Proxy
18
+
19
+ You can disable the RDS proxy as follows:
20
+
21
+ <Infrastructure>
22
+ <Fragment slot="cdk">
23
+
24
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
25
+ import { MyDatabase } from ':my-scope/common-constructs';
26
+
27
+ const db = new MyDatabase(this, 'Db', {
28
+ ...
29
+ enableRdsProxy: false,
30
+ });
31
+ ```
32
+
33
+ When RDS Proxy is disabled, your application connects directly to the Aurora cluster endpoint.
34
+ </Fragment>
35
+ <Fragment slot="terraform">
36
+
37
+ By default, RDS Proxy is enabled. You can disable it if needed:
38
+
39
+ ```hcl title="packages/infra/src/main.tf"
40
+ module "my_database" {
41
+ source = "../../common/terraform/src/app/dbs/my-database"
42
+ ...
43
+ enable_rds_proxy = false
44
+ }
45
+ ```
46
+
47
+ When RDS Proxy is disabled, your application connects directly to the Aurora cluster endpoint.
48
+ </Fragment>
49
+ </Infrastructure>
50
+
@@ -0,0 +1,57 @@
1
+ ---
2
+ title: Removal Policy
3
+ ---
4
+ import Infrastructure from '@components/infrastructure.astro';
5
+
6
+ The CDK construct retains the Aurora cluster by default (`removalPolicy: RemovalPolicy.RETAIN`). Change this when you want CDK stack deletion to snapshot or destroy the cluster instead.
7
+
8
+ When using `RemovalPolicy.DESTROY`, deletion protection must also be disabled before the cluster can be deleted.
9
+
10
+ <Infrastructure>
11
+ <Fragment slot="cdk">
12
+
13
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
14
+ import { RemovalPolicy } from 'aws-cdk-lib';
15
+ import { MyDatabase } from ':my-scope/common-constructs';
16
+
17
+ const db = new MyDatabase(this, 'Db', {
18
+ ...
19
+ removalPolicy: RemovalPolicy.SNAPSHOT,
20
+ });
21
+ ```
22
+
23
+ For an ephemeral environment where the database should be deleted with the stack:
24
+
25
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
26
+ import { RemovalPolicy } from 'aws-cdk-lib';
27
+ import { MyDatabase } from ':my-scope/common-constructs';
28
+
29
+ const db = new MyDatabase(this, 'Db', {
30
+ ...
31
+ deletionProtection: false,
32
+ removalPolicy: RemovalPolicy.DESTROY,
33
+ });
34
+ ```
35
+
36
+ ::::caution[Data Loss]
37
+ `RemovalPolicy.DESTROY` will permanently erase all data when the stack is deleted. Use only in ephemeral environments (such as automated tests). Use `RETAIN` or `SNAPSHOT` for all persistent and production stacks to prevent data loss.
38
+ ::::
39
+ </Fragment>
40
+ <Fragment slot="terraform">
41
+
42
+ Terraform does not use CDK removal policies. By default, the module creates a final snapshot on deletion (`skip_final_snapshot = false`). To skip the final snapshot for an ephemeral environment:
43
+
44
+ ```hcl title="packages/infra/src/main.tf"
45
+ module "my_database" {
46
+ source = "../../common/terraform/src/app/dbs/my-database"
47
+ ...
48
+ deletion_protection = false
49
+ skip_final_snapshot = true
50
+ }
51
+ ```
52
+
53
+ ::::caution[Data Loss]
54
+ `skip_final_snapshot = true` will permanently erase all data when the cluster is deleted. Use only in ephemeral environments (such as automated tests). Keep `skip_final_snapshot = false` for all persistent and production stacks to prevent data loss.
55
+ ::::
56
+ </Fragment>
57
+ </Infrastructure>
@@ -0,0 +1,32 @@
1
+ ---
2
+ title: Serverless Capacity
3
+ ---
4
+ import Infrastructure from '@components/infrastructure.astro';
5
+
6
+ Control Aurora Serverless v2 scaling limits to match your workload.
7
+
8
+ <Infrastructure>
9
+ <Fragment slot="cdk">
10
+
11
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
12
+ import { MyDatabase } from ':my-scope/common-constructs';
13
+
14
+ const db = new MyDatabase(this, 'Db', {
15
+ ...
16
+ serverlessV2MinCapacity: 0.5,
17
+ serverlessV2MaxCapacity: 8,
18
+ });
19
+ ```
20
+ </Fragment>
21
+ <Fragment slot="terraform">
22
+
23
+ ```hcl title="packages/infra/src/main.tf"
24
+ module "my_database" {
25
+ source = "../../common/terraform/src/app/dbs/my-database"
26
+ ...
27
+ serverless_min_capacity = 0.5
28
+ serverless_max_capacity = 8
29
+ }
30
+ ```
31
+ </Fragment>
32
+ </Infrastructure>
package/generators.json CHANGED
@@ -448,6 +448,33 @@
448
448
  "description": "Connect a py#mcp-server to a py#dynamodb project",
449
449
  "metric": "g55",
450
450
  "hidden": true
451
+ },
452
+ "py#rdb": {
453
+ "factory": "./src/py/rdb/generator",
454
+ "schema": "./src/py/rdb/schema.json",
455
+ "description": "Create a Python relational database project",
456
+ "metric": "g56"
457
+ },
458
+ "py#rdb#fast-api-connection": {
459
+ "factory": "./src/py/rdb/fast-api-connection/generator",
460
+ "schema": "./src/py/rdb/fast-api-connection/schema.json",
461
+ "description": "Connect a py#fast-api project to a py#rdb project",
462
+ "metric": "g57",
463
+ "hidden": true
464
+ },
465
+ "py#rdb#agent-connection": {
466
+ "factory": "./src/py/rdb/agent-connection/generator",
467
+ "schema": "./src/py/rdb/agent-connection/schema.json",
468
+ "description": "Connect a py#agent to a py#rdb project",
469
+ "metric": "g58",
470
+ "hidden": true
471
+ },
472
+ "py#rdb#mcp-server-connection": {
473
+ "factory": "./src/py/rdb/mcp-server-connection/generator",
474
+ "schema": "./src/py/rdb/mcp-server-connection/schema.json",
475
+ "description": "Connect a py#mcp-server to a py#rdb project",
476
+ "metric": "g59",
477
+ "hidden": true
451
478
  }
452
479
  }
453
480
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/nx-plugin-mcp",
3
- "version": "1.0.0-rc.32",
3
+ "version": "1.0.0-rc.34",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/awslabs/nx-plugin-for-aws.git",
@@ -31,6 +31,12 @@
31
31
  "x-priority": "important",
32
32
  "x-prompt": "Which container engine would you like to use? (default: infer)"
33
33
  },
34
+ "module": {
35
+ "type": "string",
36
+ "description": "Module format for generated TypeScript code and configuration.",
37
+ "enum": ["esm", "cjs"],
38
+ "default": "esm"
39
+ },
34
40
  "preferInstallDependencies": {
35
41
  "type": "boolean",
36
42
  "description": "Whether to prefer installing dependencies after the generator runs. Set to false to defer installing when batching multiple generators (an install still runs if needed so subsequent generators can compute the Nx project graph); install once at the end.",