@aws/nx-plugin-mcp 1.0.0-rc.9 → 1.0.0-rc.91

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 (200) hide show
  1. package/bin/aws-nx-mcp.js +13439 -11631
  2. package/docs/get_started/building-with-ai.mdx +116 -0
  3. package/docs/get_started/concepts.mdx +67 -0
  4. package/docs/get_started/existing-project.mdx +180 -0
  5. package/docs/get_started/graph-builder.mdx +39 -0
  6. package/docs/get_started/quick-start.mdx +277 -0
  7. package/docs/get_started/tutorials/contribute-generator.mdx +408 -0
  8. package/docs/get_started/tutorials/dungeon-game/1.mdx +1578 -0
  9. package/docs/get_started/tutorials/dungeon-game/2.mdx +245 -0
  10. package/docs/get_started/tutorials/dungeon-game/3.mdx +66 -0
  11. package/docs/get_started/tutorials/dungeon-game/4.mdx +164 -0
  12. package/docs/get_started/tutorials/dungeon-game/overview.mdx +145 -0
  13. package/docs/get_started/tutorials/dungeon-game/wrap-up.mdx +41 -0
  14. package/docs/get_started/upgrading.mdx +157 -0
  15. package/docs/guides/agentcore-gateway.mdx +490 -0
  16. package/docs/guides/agentcore-harness.mdx +312 -0
  17. package/docs/guides/astro-docs.mdx +8 -0
  18. package/docs/guides/connection/agentcore-gateway-agent.mdx +222 -0
  19. package/docs/guides/connection/agentcore-gateway-gateway.mdx +154 -0
  20. package/docs/guides/connection/agentcore-gateway-mcp.mdx +134 -0
  21. package/docs/guides/connection/py-agent-a2a.mdx +48 -16
  22. package/docs/guides/connection/py-agent-dynamodb.mdx +115 -0
  23. package/docs/guides/connection/py-agent-gateway.mdx +182 -0
  24. package/docs/guides/connection/py-agent-mcp.mdx +43 -14
  25. package/docs/guides/connection/py-agent-rdb.mdx +169 -0
  26. package/docs/guides/connection/py-fast-api-dynamodb.mdx +56 -0
  27. package/docs/guides/connection/py-fast-api-rdb.mdx +175 -0
  28. package/docs/guides/connection/py-mcp-server-dynamodb.mdx +115 -0
  29. package/docs/guides/connection/py-mcp-server-rdb.mdx +178 -0
  30. package/docs/guides/connection/react-agentcore-gateway.mdx +112 -0
  31. package/docs/guides/connection/react-agui.mdx +33 -14
  32. package/docs/guides/connection/react-fastapi.mdx +39 -3
  33. package/docs/guides/connection/react-py-agent.mdx +10 -16
  34. package/docs/guides/connection/react-smithy.mdx +4 -4
  35. package/docs/guides/connection/react-trpc.mdx +1 -1
  36. package/docs/guides/connection/react-ts-agent.mdx +9 -9
  37. package/docs/guides/connection/smithy-dynamodb.mdx +5 -5
  38. package/docs/guides/connection/smithy-rdb.mdx +9 -9
  39. package/docs/guides/connection/trpc-dynamodb.mdx +4 -4
  40. package/docs/guides/connection/trpc-rdb.mdx +5 -5
  41. package/docs/guides/connection/ts-agent-a2a.mdx +14 -11
  42. package/docs/guides/connection/ts-agent-dynamodb.mdx +35 -36
  43. package/docs/guides/connection/ts-agent-gateway.mdx +147 -0
  44. package/docs/guides/connection/ts-agent-mcp.mdx +12 -9
  45. package/docs/guides/connection/ts-agent-rdb.mdx +61 -25
  46. package/docs/guides/connection/ts-mcp-server-dynamodb.mdx +35 -36
  47. package/docs/guides/connection/ts-mcp-server-rdb.mdx +59 -18
  48. package/docs/guides/connection.mdx +122 -5
  49. package/docs/guides/docker-bundling.mdx +82 -14
  50. package/docs/guides/fastapi.mdx +253 -12
  51. package/docs/guides/local-development.mdx +87 -0
  52. package/docs/guides/nx-generator.mdx +4 -3
  53. package/docs/guides/nx-migration.mdx +165 -0
  54. package/docs/guides/py-agent.mdx +332 -55
  55. package/docs/guides/py-dynamodb.mdx +476 -0
  56. package/docs/guides/py-mcp-server.mdx +57 -2
  57. package/docs/guides/py-rdb.mdx +269 -0
  58. package/docs/guides/python-lambda-function.mdx +1 -1
  59. package/docs/guides/python-project.mdx +31 -0
  60. package/docs/guides/react-website-auth.mdx +104 -5
  61. package/docs/guides/react-website.mdx +409 -95
  62. package/docs/guides/runtime-config.mdx +17 -4
  63. package/docs/guides/security.mdx +75 -0
  64. package/docs/guides/smithy-project.mdx +167 -0
  65. package/docs/guides/terraform-project.mdx +119 -8
  66. package/docs/guides/trpc.mdx +55 -14
  67. package/docs/guides/ts-agent.mdx +207 -23
  68. package/docs/guides/ts-dcr-proxy.mdx +569 -0
  69. package/docs/guides/ts-dynamodb.mdx +66 -242
  70. package/docs/guides/ts-lambda-function.mdx +1 -1
  71. package/docs/guides/ts-mcp-server.mdx +111 -29
  72. package/docs/guides/ts-nx-plugin.mdx +4 -4
  73. package/docs/guides/ts-rdb.mdx +116 -466
  74. package/docs/guides/ts-smithy-api.mdx +260 -16
  75. package/docs/guides/typescript-infrastructure.mdx +79 -25
  76. package/docs/guides/typescript-project.mdx +157 -24
  77. package/docs/guides/workspace.mdx +31 -2
  78. package/docs/snippets/agent/architecture.mdx +1 -1
  79. package/docs/snippets/agent/bedrock-deployment.mdx +9 -5
  80. package/docs/snippets/agent/runtime-arn.mdx +23 -2
  81. package/docs/snippets/agent/securing-your-agent.mdx +39 -0
  82. package/docs/snippets/api/access-logging.mdx +38 -0
  83. package/docs/snippets/api/cors-configuration-cdk-note.mdx +1 -1
  84. package/docs/snippets/api/cors-configuration-terraform-note.mdx +1 -1
  85. package/docs/snippets/api/type-safe-api-integrations.mdx +218 -373
  86. package/docs/snippets/api/waf-configuration.mdx +3 -3
  87. package/docs/snippets/connection/a2a-infrastructure.mdx +1 -1
  88. package/docs/snippets/connection/dynamodb-local-development.mdx +2 -2
  89. package/docs/snippets/connection/lambda-dynamodb-access.mdx +2 -2
  90. package/docs/snippets/connection/py-dynamodb-local-development.mdx +7 -0
  91. package/docs/snippets/connection/py-lambda-rdb-ssl-requirements.mdx +7 -0
  92. package/docs/snippets/connection/rdb-api-infrastructure.mdx +42 -19
  93. package/docs/snippets/dynamodb/deploying-table.mdx +176 -0
  94. package/docs/snippets/dynamodb/encryption-options.mdx +168 -0
  95. package/docs/snippets/dynamodb/gsi-config.mdx +38 -0
  96. package/docs/snippets/dynamodb/infrastructure.mdx +33 -0
  97. package/docs/snippets/dynamodb/local-dev-start.mdx +13 -0
  98. package/docs/snippets/dynamodb/local-dev-windows.mdx +15 -0
  99. package/docs/snippets/experimental-generator.mdx +8 -0
  100. package/docs/snippets/lambda-function/deploying-your-function.mdx +3 -3
  101. package/docs/snippets/mcp/architecture.mdx +1 -1
  102. package/docs/snippets/mcp/bedrock-deployment.mdx +9 -5
  103. package/docs/snippets/mcp/config.mdx +3 -2
  104. package/docs/snippets/mcp/shared-constructs.mdx +4 -5
  105. package/docs/snippets/pdk-migration/example/01-migrate-api.mdx +7 -5
  106. package/docs/snippets/pdk-migration/example/02-migrate-website.mdx +29 -10
  107. package/docs/snippets/pdk-migration/example/03-migrate-infra.mdx +4 -4
  108. package/docs/snippets/pdk-migration/faq/type-safe-api.mdx +5 -111
  109. package/docs/snippets/prerequisites.mdx +1 -4
  110. package/docs/snippets/rdb/admin-credentials.mdx +42 -0
  111. package/docs/snippets/rdb/architecture.mdx +39 -0
  112. package/docs/snippets/rdb/cluster-instances.mdx +31 -0
  113. package/docs/snippets/rdb/deletion-protection.mdx +64 -0
  114. package/docs/snippets/rdb/deploying.mdx +178 -0
  115. package/docs/snippets/rdb/encryption-key-rotation.mdx +30 -0
  116. package/docs/snippets/rdb/engine-version.mdx +63 -0
  117. package/docs/snippets/rdb/infrastructure.mdx +35 -0
  118. package/docs/snippets/rdb/logging-mysql.mdx +5 -0
  119. package/docs/snippets/rdb/logging-postgres.mdx +5 -0
  120. package/docs/snippets/rdb/performance-insights.mdx +36 -0
  121. package/docs/snippets/rdb/rds-proxy.mdx +50 -0
  122. package/docs/snippets/rdb/removal-policy.mdx +57 -0
  123. package/docs/snippets/rdb/serverless-capacity.mdx +32 -0
  124. package/docs/snippets/recommended-prerequisites.mdx +10 -0
  125. package/docs/snippets/required-prerequisites.mdx +1 -4
  126. package/docs/snippets/runtime-config-app-id-note.mdx +8 -0
  127. package/docs/snippets/shared-constructs.mdx +1 -1
  128. package/docs/snippets/trivy-image-scan.mdx +37 -0
  129. package/generators.json +170 -10
  130. package/package.json +1 -1
  131. package/src/agentcore-gateway/agent-connection/schema.json +31 -0
  132. package/src/agentcore-gateway/gateway-connection/schema.json +31 -0
  133. package/src/agentcore-gateway/mcp-connection/schema.json +31 -0
  134. package/src/agentcore-gateway/react-connection/schema.json +31 -0
  135. package/src/agentcore-gateway/schema.json +72 -0
  136. package/src/agentcore-harness/schema.json +53 -0
  137. package/src/connection/schema.json +5 -0
  138. package/src/infra/app/schema.json +5 -0
  139. package/src/init/schema.json +35 -0
  140. package/src/internal/test-matrix/schema.json +21 -0
  141. package/src/license/schema.json +5 -0
  142. package/src/open-api/json-metadata/schema.json +20 -0
  143. package/src/preset/schema.json +16 -5
  144. package/src/py/agent/a2a-connection/schema.json +5 -0
  145. package/src/py/agent/gateway-connection/schema.json +31 -0
  146. package/src/py/agent/mcp-connection/schema.json +5 -0
  147. package/src/py/agent/react-connection/schema.json +5 -0
  148. package/src/py/agent/schema.json +15 -1
  149. package/src/py/api/schema.json +5 -0
  150. package/src/py/dynamodb/agent-connection/schema.json +27 -0
  151. package/src/py/dynamodb/fast-api-connection/schema.json +23 -0
  152. package/src/py/dynamodb/mcp-server-connection/schema.json +27 -0
  153. package/src/py/dynamodb/schema.json +76 -0
  154. package/src/py/fast-api/react/schema.json +5 -0
  155. package/src/py/fast-api/schema.json +6 -0
  156. package/src/py/lambda-function/schema.json +6 -1
  157. package/src/py/mcp-server/schema.json +6 -0
  158. package/src/py/project/schema.json +6 -0
  159. package/src/py/rdb/agent-connection/schema.json +27 -0
  160. package/src/py/rdb/fast-api-connection/schema.json +23 -0
  161. package/src/py/rdb/mcp-server-connection/schema.json +27 -0
  162. package/src/py/rdb/schema.json +78 -0
  163. package/src/smithy/project/schema.json +28 -1
  164. package/src/smithy/react-connection/schema.json +5 -0
  165. package/src/smithy/ts/api/schema.json +6 -0
  166. package/src/terraform/project/schema.json +5 -0
  167. package/src/trpc/backend/schema.json +6 -0
  168. package/src/trpc/react/schema.json +5 -0
  169. package/src/ts/agent/a2a-connection/schema.json +5 -0
  170. package/src/ts/agent/gateway-connection/schema.json +31 -0
  171. package/src/ts/agent/mcp-connection/schema.json +5 -0
  172. package/src/ts/agent/react-connection/schema.json +5 -0
  173. package/src/ts/agent/schema.json +14 -0
  174. package/src/ts/api/schema.json +5 -0
  175. package/src/ts/astro-docs/schema.json +3 -3
  176. package/src/ts/dcr-proxy/schema.json +44 -0
  177. package/src/ts/docs/schema.json +3 -3
  178. package/src/ts/dynamodb/agent-connection/schema.json +5 -0
  179. package/src/ts/dynamodb/mcp-server-connection/schema.json +5 -0
  180. package/src/ts/dynamodb/schema.json +26 -2
  181. package/src/ts/dynamodb/smithy-connection/schema.json +5 -0
  182. package/src/ts/dynamodb/trpc-connection/schema.json +5 -0
  183. package/src/ts/lambda-function/schema.json +5 -0
  184. package/src/ts/lib/schema.json +5 -0
  185. package/src/ts/mcp-server/schema.json +6 -0
  186. package/src/ts/nx-generator/schema.json +5 -0
  187. package/src/ts/nx-migration/schema.json +63 -0
  188. package/src/ts/nx-plugin/schema.json +5 -0
  189. package/src/ts/rdb/agent-connection/schema.json +5 -0
  190. package/src/ts/rdb/mcp-server-connection/schema.json +5 -0
  191. package/src/ts/rdb/schema.json +7 -1
  192. package/src/ts/rdb/smithy-connection/schema.json +5 -0
  193. package/src/ts/rdb/trpc-connection/schema.json +5 -0
  194. package/src/ts/react-website/app/schema.json +12 -6
  195. package/src/ts/react-website/cognito-auth/schema.json +5 -0
  196. package/src/ts/react-website/runtime-config/schema.json +5 -0
  197. package/src/ts/website/app/schema.json +11 -6
  198. package/src/ts/website/auth/schema.json +5 -0
  199. /package/docs/snippets/connection/{lambda-rdb-ssl-requirements.mdx → ts-lambda-rdb-ssl-requirements.mdx} +0 -0
  200. /package/docs/snippets/connection/{mcp-server-rdb-ssl-requirements.mdx → ts-mcp-server-rdb-ssl-requirements.mdx} +0 -0
@@ -0,0 +1,178 @@
1
+ ---
2
+ title: Deploying your Relational Database
3
+ ---
4
+ import Infrastructure from '@components/infrastructure.astro';
5
+ import Link from '@components/link.astro';
6
+ import Drawer from '@components/drawer.astro';
7
+
8
+ The relational database generator creates CDK or Terraform infrastructure based on your selected `iac`.
9
+
10
+ <Infrastructure>
11
+ <Fragment slot="cdk">
12
+ The CDK construct is created in `common/constructs`. Example usage:
13
+
14
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
15
+ import { MyDatabase } from '@my-scope/common-constructs';
16
+
17
+ export class ApplicationStack extends Stack {
18
+ constructor(scope: Construct, id: string, props?: StackProps) {
19
+ super(scope, id, props);
20
+ ...
21
+ const db = new MyDatabase(this, 'Db', {
22
+ vpc,
23
+ vpcSubnets: {
24
+ subnetType: SubnetType.PRIVATE_ISOLATED,
25
+ }
26
+ });
27
+ }
28
+ }
29
+ ```
30
+
31
+ This provisions an Aurora cluster with RDS Proxy, admin credentials, application database user, runtime config registration, and migration handler.
32
+
33
+ The generated infrastructure creates two database users:
34
+ - **Admin user** - Created during cluster provisioning with credentials stored in AWS Secrets Manager
35
+ - **Application user** - Created via a Lambda custom resource with IAM authentication enabled and DML privileges (SELECT, INSERT, UPDATE, DELETE) on the application database
36
+ </Fragment>
37
+ <Fragment slot="terraform">
38
+ The Terraform module is created in `common/terraform`. Example usage:
39
+
40
+ ```hcl title="packages/infra/src/main.tf"
41
+ module "my_database" {
42
+ source = "../../common/terraform/src/app/dbs/my-database"
43
+
44
+ # Database subnets have no internet route; Lambda subnets need NAT egress.
45
+ vpc_id = aws_vpc.main.id
46
+ database_subnet_ids = aws_subnet.database[*].id
47
+ lambda_subnet_ids = aws_subnet.private[*].id
48
+
49
+ tags = local.common_tags
50
+ }
51
+ ```
52
+
53
+ This provisions an Aurora cluster with RDS Proxy, admin credentials, create-db-user Lambda, runtime config registration, migration Lambda, and container registry resources.
54
+
55
+ The database module registers its connection details under the `database` <Link path="guides/runtime-config">runtime configuration</Link> namespace, which the shared runtime configuration AppConfig application exposes by default.
56
+
57
+ The generated infrastructure creates two database users:
58
+ - **Admin user** - Created during cluster provisioning with credentials stored in AWS Secrets Manager
59
+ - **Application user** - Created via a Lambda function with IAM authentication enabled and DML privileges (SELECT, INSERT, UPDATE, DELETE) on the application database
60
+ </Fragment>
61
+ </Infrastructure>
62
+
63
+ 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.
64
+
65
+ 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.
66
+
67
+ <Drawer title="Example VPC configuration" trigger="Click here for an example VPC configuration.">
68
+
69
+ <Infrastructure>
70
+ <Fragment slot="cdk">
71
+
72
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
73
+ const vpc = new Vpc(this, 'Vpc', {
74
+ subnetConfiguration: [
75
+ {
76
+ name: 'public',
77
+ subnetType: SubnetType.PUBLIC,
78
+ },
79
+ {
80
+ name: 'private_with_egress',
81
+ subnetType: SubnetType.PRIVATE_WITH_EGRESS,
82
+ },
83
+ {
84
+ name: 'private_isolated',
85
+ subnetType: SubnetType.PRIVATE_ISOLATED,
86
+ },
87
+ ],
88
+ });
89
+ ```
90
+
91
+ </Fragment>
92
+ <Fragment slot="terraform">
93
+
94
+ ```hcl title="packages/infra/src/main.tf"
95
+ data "aws_availability_zones" "available" {
96
+ state = "available"
97
+ }
98
+
99
+ resource "aws_vpc" "main" {
100
+ cidr_block = "10.0.0.0/16"
101
+ enable_dns_hostnames = true
102
+ enable_dns_support = true
103
+ }
104
+
105
+ # Isolated subnets for the database: no route to the internet
106
+ resource "aws_subnet" "database" {
107
+ count = 2
108
+ vpc_id = aws_vpc.main.id
109
+ cidr_block = cidrsubnet(aws_vpc.main.cidr_block, 8, count.index)
110
+ availability_zone = data.aws_availability_zones.available.names[count.index]
111
+ }
112
+
113
+ # Private subnets with NAT egress for Lambda functions and runtimes,
114
+ # so they can reach AWS services such as AppConfig
115
+ resource "aws_subnet" "private" {
116
+ count = 2
117
+ vpc_id = aws_vpc.main.id
118
+ cidr_block = cidrsubnet(aws_vpc.main.cidr_block, 8, count.index + 2)
119
+ availability_zone = data.aws_availability_zones.available.names[count.index]
120
+ }
121
+
122
+ # Public subnet hosting the NAT gateway
123
+ resource "aws_subnet" "public" {
124
+ vpc_id = aws_vpc.main.id
125
+ cidr_block = cidrsubnet(aws_vpc.main.cidr_block, 8, 4)
126
+ availability_zone = data.aws_availability_zones.available.names[0]
127
+ }
128
+
129
+ resource "aws_internet_gateway" "main" {
130
+ vpc_id = aws_vpc.main.id
131
+ }
132
+
133
+ resource "aws_route_table" "public" {
134
+ vpc_id = aws_vpc.main.id
135
+
136
+ route {
137
+ cidr_block = "0.0.0.0/0"
138
+ gateway_id = aws_internet_gateway.main.id
139
+ }
140
+ }
141
+
142
+ resource "aws_route_table_association" "public" {
143
+ subnet_id = aws_subnet.public.id
144
+ route_table_id = aws_route_table.public.id
145
+ }
146
+
147
+ resource "aws_eip" "nat" {
148
+ domain = "vpc"
149
+ }
150
+
151
+ resource "aws_nat_gateway" "main" {
152
+ allocation_id = aws_eip.nat.id
153
+ subnet_id = aws_subnet.public.id
154
+ depends_on = [aws_internet_gateway.main]
155
+ }
156
+
157
+ resource "aws_route_table" "private" {
158
+ vpc_id = aws_vpc.main.id
159
+
160
+ route {
161
+ cidr_block = "0.0.0.0/0"
162
+ nat_gateway_id = aws_nat_gateway.main.id
163
+ }
164
+ }
165
+
166
+ resource "aws_route_table_association" "private" {
167
+ count = 2
168
+ subnet_id = aws_subnet.private[count.index].id
169
+ route_table_id = aws_route_table.private.id
170
+ }
171
+ ```
172
+
173
+ </Fragment>
174
+ </Infrastructure>
175
+
176
+ </Drawer>
177
+
178
+ 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,5 @@
1
+ ---
2
+ title: MySQL Query Logging
3
+ ---
4
+
5
+ The `audit` and `error` logs are exported for [Aurora MySQL](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Integrating.CloudWatch.html) — `general` and `slowquery` are deliberately excluded since they log full statement text, including DML values. [Advanced Auditing](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Auditing.html) is scoped to connections and DDL (`server_audit_events=CONNECT,QUERY_DDL`), so statement parameter values are never logged.
@@ -0,0 +1,5 @@
1
+ ---
2
+ title: PostgreSQL Query Logging
3
+ ---
4
+
5
+ The `postgresql` log is exported for [Aurora PostgreSQL](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.CloudWatch.html), with logging scoped to DDL statements only (`log_statement=ddl`) so statement parameter values are never logged — as long as each statement is sent on its own. `log_statement=ddl` logs the entire raw text of a multi-statement batch (e.g. a single `psql -c "a;b;c"` call) verbatim if any statement in it is DDL, including any DML values in that same batch.
@@ -0,0 +1,36 @@
1
+ ---
2
+ title: Performance Insights
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). Aurora engine logs are also exported to [CloudWatch Logs](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_LogAccess.html) by default, configured to surface schema-level activity without leaking row data.
7
+
8
+ Exported log volume — and so [CloudWatch Logs ingestion cost](https://aws.amazon.com/cloudwatch/pricing/) — scales with schema changes and connections rather than query traffic, since the log types that carry full statement text are excluded. On Aurora MySQL the `CONNECT` audit event is emitted per connection, so workloads that open a connection per request produce more than ones that pool.
9
+
10
+ Disable log export per database if not required:
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
+ enableCloudwatchLogs: false,
21
+ enablePerformanceInsights: false,
22
+ });
23
+ ```
24
+ </Fragment>
25
+ <Fragment slot="terraform">
26
+
27
+ ```hcl title="packages/infra/src/main.tf"
28
+ module "my_database" {
29
+ source = "../../common/terraform/src/app/dbs/my-database"
30
+ ...
31
+ enable_cloudwatch_logs = false # disable if not required
32
+ enable_performance_insights = false # disable if not required
33
+ }
34
+ ```
35
+ </Fragment>
36
+ </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. Both providers default to a minimum of 0.5 ACUs and a maximum of 4.
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>
@@ -0,0 +1,10 @@
1
+ ---
2
+ title: Recommended Prerequisites
3
+ ---
4
+ - [PNPM >= 11](https://pnpm.io/installation#using-npm) (you can also use [Yarn >= 4](https://yarnpkg.com/getting-started/install), [Bun >= 1](https://bun.sh/docs/installation), or [NPM >= 10](https://nodejs.org/en/learn/getting-started/an-introduction-to-the-npm-package-manager) if you prefer)
5
+ - verify by running `pnpm --version`, `yarn --version`, `bun --version` or `npm --version`
6
+ - [AWS Credentials](https://docs.aws.amazon.com/sdkref/latest/guide/access.html) configured to your target AWS account are required to deploy your application (as well as for some local development workflows).
7
+ - [Docker](https://www.docker.com/) or [Finch >= 1.6.0](https://runfinch.com/) is required for some generators. For Docker, [multi-platform builds](https://docs.docker.com/build/building/multi-platform/) must be set up; Finch supports [multi-platform builds](https://runfinch.com/docs/getting-started/building-images/#building-a-multi-architecture-container-image) out of the box.
8
+ - [Terraform >= 1.12](https://developer.hashicorp.com/terraform/install) is required if you choose to use this for infrastructure as code instead of CDK
9
+ - verify by running `terraform --version`
10
+ - If you are using [VSCode](https://code.visualstudio.com/), we recommend installing the [Nx Console VSCode Plugin](https://marketplace.visualstudio.com/items?itemName=nrwl.angular-console).
@@ -4,9 +4,6 @@ title: Required Prerequisites
4
4
  - [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
5
5
  - [Node >= 22](https://nodejs.org/en/download) (We recommend using something like [NVM](https://github.com/nvm-sh/nvm) to manage your node versions)
6
6
  - verify by running `node --version`
7
- - [PNPM >= 11](https://pnpm.io/installation#using-npm) (you can also use [Yarn >= 4](https://yarnpkg.com/getting-started/install), [Bun >= 1](https://bun.sh/docs/installation), or [NPM >= 10](https://nodejs.org/en/learn/getting-started/an-introduction-to-the-npm-package-manager) if you prefer)
8
- - verify by running `pnpm --version`, `yarn --version`, `bun --version` or `npm --version`
9
7
  - [UV >= 0.5.29](https://docs.astral.sh/uv/getting-started/installation/)
10
8
  1. install Python 3.14 by running: `uv python install 3.14.0`
11
- 2. verify with `uv python list --only-installed`
12
- - [AWS Credentials](https://docs.aws.amazon.com/sdkref/latest/guide/access.html) configured to your target AWS account (where your application will be deployed)
9
+ 2. verify with `uv python list --only-installed`
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: Runtime Config App ID Note
3
+ ---
4
+ import Link from '@components/link.astro';
5
+
6
+ :::note[Runtime config]
7
+ This relies on the `RUNTIME_CONFIG_APP_ID` environment variable to fetch configuration from AWS AppConfig at runtime. Projects built with this plugin (APIs, Agents, MCP servers) already have this variable configured automatically. For other projects, ensure `RUNTIME_CONFIG_APP_ID` is set in the runtime environment with the AppConfig application ID provisioned by your infrastructure. For more information, see the <Link path="guides/runtime-config">Runtime Configuration guide</Link>.
8
+ :::
@@ -5,7 +5,7 @@ import { FileTree } from '@astrojs/starlight/components';
5
5
  import Infrastructure from '@components/infrastructure.astro';
6
6
  import Link from '@components/link.astro';
7
7
 
8
- Since this generator vends infrastructure as code based on your chosen `iacProvider`, it will create a project in `packages/common` which includes the relevant CDK constructs or Terraform modules.
8
+ Since this generator vends infrastructure as code based on your chosen `iac`, it will create a project in `packages/common` which includes the relevant CDK constructs or Terraform modules.
9
9
 
10
10
  The common infrastructure as code project is structured as follows:
11
11
 
@@ -0,0 +1,37 @@
1
+ ---
2
+ title: Container Image Scanning
3
+ ---
4
+
5
+ import PackageManagerShortCommand from '@components/package-manager-short-command.astro';
6
+
7
+ The Docker image built for this project can be scanned for vulnerabilities using [Trivy](https://trivy.dev/), running from the [ECR-hosted Trivy image](https://gallery.ecr.aws/aquasecurity/trivy).
8
+
9
+ A `trivy` target is added to your project which scans the built image and **exits non-zero** if any `HIGH` or `CRITICAL` severity vulnerability is found. The generated `Dockerfile` uses a base image with no known fixable vulnerabilities of these severities at time of generation, and upgrades bundled tooling (such as `npm`) to keep it that way.
10
+
11
+ The scan uses the same container engine as your image build (`docker` or `finch`), so no additional tooling is required. The scan is not cached, since the image it reads lives in the container engine rather than on disk — so it always scans the real image, and fails loudly rather than reporting a cached pass for an image that is no longer there. Each run therefore takes tens of seconds per image and refreshes Trivy's vulnerability database, so it needs network access. The vended `trivy` root script scans every image in the workspace:
12
+
13
+ <PackageManagerShortCommand commands={['trivy']} />
14
+
15
+ :::tip[Run Trivy in CI]
16
+ The scan is intentionally not wired into `build` since this can introduce unnecessary friction when iterating during development, as Trivy's vulnerabilty database is continually updated with new CVEs.
17
+
18
+ Instead we recommend running the above command as a dedicated step in your CI pipeline prior to deployment to production stages.
19
+ :::
20
+
21
+ :::caution[Unfixable vulnerabilities are ignored]
22
+ The scan runs with `--ignore-unfixed`, so vulnerabilities without an available fix do not fail the build, since they cannot be actioned by upgrading tooling in your `Dockerfile` — they are not reported in the build's scan output. As new vulnerabilities are disclosed the result of scans may change over time, so review the image periodically by running `trivy image <your-image>` without the flag, and rebuild against a newer base image (or add container steps to apply available patches) once a fix is published.
23
+ :::
24
+
25
+ #### Suppressing Trivy Findings
26
+
27
+ There may be instances where you want to suppress a specific vulnerability, for example when no fix is yet available and you have assessed the risk as acceptable.
28
+
29
+ Add the vulnerability ID (one per line) to the `.trivyignore` file in the root of your project (i.e. next to your `project.json`):
30
+
31
+ ```gitignore
32
+ # .trivyignore
33
+ # node-tar arbitrary file write - not exploitable in our usage
34
+ CVE-2024-XXXXX
35
+ ```
36
+
37
+ For more details on filtering findings, refer to the [Trivy filtering documentation](https://trivy.dev/latest/docs/configuration/filtering/#by-finding-ids).