@aws/nx-plugin-mcp 1.0.0-rc.8 → 1.0.0-rc.80

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 (196) hide show
  1. package/bin/aws-nx-mcp.js +14210 -13550
  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 +147 -0
  15. package/docs/guides/agentcore-gateway.mdx +490 -0
  16. package/docs/guides/agentcore-harness.mdx +275 -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 +116 -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 +178 -0
  26. package/docs/guides/connection/py-fast-api-dynamodb.mdx +56 -0
  27. package/docs/guides/connection/py-fast-api-rdb.mdx +184 -0
  28. package/docs/guides/connection/py-mcp-server-dynamodb.mdx +116 -0
  29. package/docs/guides/connection/py-mcp-server-rdb.mdx +187 -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 +5 -5
  35. package/docs/guides/connection/react-trpc.mdx +2 -2
  36. package/docs/guides/connection/react-ts-agent.mdx +9 -9
  37. package/docs/guides/connection/smithy-dynamodb.mdx +6 -6
  38. package/docs/guides/connection/smithy-rdb.mdx +10 -10
  39. package/docs/guides/connection/trpc-dynamodb.mdx +5 -5
  40. package/docs/guides/connection/trpc-rdb.mdx +6 -6
  41. package/docs/guides/connection/ts-agent-a2a.mdx +14 -11
  42. package/docs/guides/connection/ts-agent-dynamodb.mdx +5 -5
  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 +70 -25
  46. package/docs/guides/connection/ts-mcp-server-dynamodb.mdx +5 -5
  47. package/docs/guides/connection/ts-mcp-server-rdb.mdx +68 -18
  48. package/docs/guides/connection.mdx +122 -5
  49. package/docs/guides/docker-bundling.mdx +81 -12
  50. package/docs/guides/fastapi.mdx +252 -15
  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 +265 -0
  58. package/docs/guides/python-lambda-function.mdx +1 -1
  59. package/docs/guides/react-website-auth.mdx +104 -5
  60. package/docs/guides/react-website.mdx +413 -99
  61. package/docs/guides/runtime-config.mdx +1 -1
  62. package/docs/guides/security.mdx +75 -0
  63. package/docs/guides/smithy-project.mdx +167 -0
  64. package/docs/guides/terraform-project.mdx +2 -2
  65. package/docs/guides/trpc.mdx +54 -17
  66. package/docs/guides/ts-agent.mdx +207 -23
  67. package/docs/guides/ts-dcr-proxy.mdx +569 -0
  68. package/docs/guides/ts-dynamodb.mdx +66 -242
  69. package/docs/guides/ts-lambda-function.mdx +1 -1
  70. package/docs/guides/ts-mcp-server.mdx +111 -29
  71. package/docs/guides/ts-nx-plugin.mdx +4 -4
  72. package/docs/guides/ts-rdb.mdx +114 -468
  73. package/docs/guides/ts-smithy-api.mdx +259 -19
  74. package/docs/guides/typescript-infrastructure.mdx +46 -24
  75. package/docs/guides/typescript-project.mdx +134 -27
  76. package/docs/guides/workspace.mdx +10 -3
  77. package/docs/snippets/agent/architecture.mdx +1 -1
  78. package/docs/snippets/agent/bedrock-deployment.mdx +9 -5
  79. package/docs/snippets/agent/runtime-arn.mdx +23 -2
  80. package/docs/snippets/agent/securing-your-agent.mdx +39 -0
  81. package/docs/snippets/api/access-logging.mdx +38 -0
  82. package/docs/snippets/api/cors-configuration-cdk-note.mdx +1 -1
  83. package/docs/snippets/api/cors-configuration-terraform-note.mdx +1 -1
  84. package/docs/snippets/api/type-safe-api-integrations.mdx +69 -50
  85. package/docs/snippets/api/waf-configuration.mdx +3 -3
  86. package/docs/snippets/connection/a2a-infrastructure.mdx +1 -1
  87. package/docs/snippets/connection/dynamodb-local-development.mdx +2 -2
  88. package/docs/snippets/connection/lambda-dynamodb-access.mdx +1 -1
  89. package/docs/snippets/connection/py-dynamodb-local-development.mdx +7 -0
  90. package/docs/snippets/connection/py-lambda-rdb-ssl-requirements.mdx +7 -0
  91. package/docs/snippets/connection/rdb-api-infrastructure.mdx +51 -19
  92. package/docs/snippets/dynamodb/deploying-table.mdx +145 -0
  93. package/docs/snippets/dynamodb/encryption-options.mdx +168 -0
  94. package/docs/snippets/dynamodb/gsi-config.mdx +38 -0
  95. package/docs/snippets/dynamodb/infrastructure.mdx +33 -0
  96. package/docs/snippets/dynamodb/local-dev-start.mdx +13 -0
  97. package/docs/snippets/dynamodb/local-dev-windows.mdx +15 -0
  98. package/docs/snippets/lambda-function/deploying-your-function.mdx +3 -3
  99. package/docs/snippets/mcp/architecture.mdx +1 -1
  100. package/docs/snippets/mcp/bedrock-deployment.mdx +9 -5
  101. package/docs/snippets/mcp/config.mdx +3 -2
  102. package/docs/snippets/mcp/shared-constructs.mdx +4 -5
  103. package/docs/snippets/pdk-migration/example/01-migrate-api.mdx +7 -5
  104. package/docs/snippets/pdk-migration/example/02-migrate-website.mdx +29 -10
  105. package/docs/snippets/pdk-migration/example/03-migrate-infra.mdx +4 -4
  106. package/docs/snippets/pdk-migration/faq/type-safe-api.mdx +5 -111
  107. package/docs/snippets/prerequisites.mdx +1 -4
  108. package/docs/snippets/rdb/architecture.mdx +38 -0
  109. package/docs/snippets/rdb/cluster-instances.mdx +31 -0
  110. package/docs/snippets/rdb/deletion-protection.mdx +34 -0
  111. package/docs/snippets/rdb/deploying.mdx +187 -0
  112. package/docs/snippets/rdb/encryption-key-rotation.mdx +30 -0
  113. package/docs/snippets/rdb/engine-version.mdx +63 -0
  114. package/docs/snippets/rdb/infrastructure.mdx +35 -0
  115. package/docs/snippets/rdb/logging-mysql.mdx +5 -0
  116. package/docs/snippets/rdb/logging-postgres.mdx +5 -0
  117. package/docs/snippets/rdb/performance-insights.mdx +34 -0
  118. package/docs/snippets/rdb/rds-proxy.mdx +50 -0
  119. package/docs/snippets/rdb/removal-policy.mdx +57 -0
  120. package/docs/snippets/rdb/serverless-capacity.mdx +32 -0
  121. package/docs/snippets/recommended-prerequisites.mdx +10 -0
  122. package/docs/snippets/required-prerequisites.mdx +1 -4
  123. package/docs/snippets/runtime-config-app-id-note.mdx +8 -0
  124. package/docs/snippets/shared-constructs.mdx +1 -1
  125. package/docs/snippets/trivy-image-scan.mdx +37 -0
  126. package/generators.json +162 -10
  127. package/package.json +1 -1
  128. package/src/agentcore-gateway/agent-connection/schema.json +31 -0
  129. package/src/agentcore-gateway/gateway-connection/schema.json +31 -0
  130. package/src/agentcore-gateway/mcp-connection/schema.json +31 -0
  131. package/src/agentcore-gateway/react-connection/schema.json +31 -0
  132. package/src/agentcore-gateway/schema.json +72 -0
  133. package/src/agentcore-harness/schema.json +53 -0
  134. package/src/connection/schema.json +5 -0
  135. package/src/infra/app/schema.json +5 -0
  136. package/src/init/schema.json +35 -0
  137. package/src/internal/test-matrix/schema.json +21 -0
  138. package/src/license/schema.json +5 -0
  139. package/src/preset/schema.json +16 -5
  140. package/src/py/agent/a2a-connection/schema.json +5 -0
  141. package/src/py/agent/gateway-connection/schema.json +31 -0
  142. package/src/py/agent/mcp-connection/schema.json +5 -0
  143. package/src/py/agent/react-connection/schema.json +5 -0
  144. package/src/py/agent/schema.json +15 -1
  145. package/src/py/api/schema.json +5 -0
  146. package/src/py/dynamodb/agent-connection/schema.json +27 -0
  147. package/src/py/dynamodb/fast-api-connection/schema.json +23 -0
  148. package/src/py/dynamodb/mcp-server-connection/schema.json +27 -0
  149. package/src/py/dynamodb/schema.json +76 -0
  150. package/src/py/fast-api/react/schema.json +5 -0
  151. package/src/py/fast-api/schema.json +6 -0
  152. package/src/py/lambda-function/schema.json +6 -1
  153. package/src/py/mcp-server/schema.json +6 -0
  154. package/src/py/project/schema.json +6 -0
  155. package/src/py/rdb/agent-connection/schema.json +27 -0
  156. package/src/py/rdb/fast-api-connection/schema.json +23 -0
  157. package/src/py/rdb/mcp-server-connection/schema.json +27 -0
  158. package/src/py/rdb/schema.json +78 -0
  159. package/src/smithy/project/schema.json +28 -1
  160. package/src/smithy/react-connection/schema.json +5 -0
  161. package/src/smithy/ts/api/schema.json +6 -0
  162. package/src/terraform/project/schema.json +5 -0
  163. package/src/trpc/backend/schema.json +6 -0
  164. package/src/trpc/react/schema.json +5 -0
  165. package/src/ts/agent/a2a-connection/schema.json +5 -0
  166. package/src/ts/agent/gateway-connection/schema.json +31 -0
  167. package/src/ts/agent/mcp-connection/schema.json +5 -0
  168. package/src/ts/agent/react-connection/schema.json +5 -0
  169. package/src/ts/agent/schema.json +14 -0
  170. package/src/ts/api/schema.json +5 -0
  171. package/src/ts/astro-docs/schema.json +3 -3
  172. package/src/ts/dcr-proxy/schema.json +44 -0
  173. package/src/ts/docs/schema.json +3 -3
  174. package/src/ts/dynamodb/agent-connection/schema.json +5 -0
  175. package/src/ts/dynamodb/mcp-server-connection/schema.json +5 -0
  176. package/src/ts/dynamodb/schema.json +26 -2
  177. package/src/ts/dynamodb/smithy-connection/schema.json +5 -0
  178. package/src/ts/dynamodb/trpc-connection/schema.json +5 -0
  179. package/src/ts/lambda-function/schema.json +5 -0
  180. package/src/ts/lib/schema.json +5 -0
  181. package/src/ts/mcp-server/schema.json +6 -0
  182. package/src/ts/nx-generator/schema.json +5 -0
  183. package/src/ts/nx-migration/schema.json +63 -0
  184. package/src/ts/nx-plugin/schema.json +5 -0
  185. package/src/ts/rdb/agent-connection/schema.json +5 -0
  186. package/src/ts/rdb/mcp-server-connection/schema.json +5 -0
  187. package/src/ts/rdb/schema.json +7 -1
  188. package/src/ts/rdb/smithy-connection/schema.json +5 -0
  189. package/src/ts/rdb/trpc-connection/schema.json +5 -0
  190. package/src/ts/react-website/app/schema.json +12 -6
  191. package/src/ts/react-website/cognito-auth/schema.json +5 -0
  192. package/src/ts/react-website/runtime-config/schema.json +5 -0
  193. package/src/ts/website/app/schema.json +11 -6
  194. package/src/ts/website/auth/schema.json +5 -0
  195. /package/docs/snippets/connection/{lambda-rdb-ssl-requirements.mdx → ts-lambda-rdb-ssl-requirements.mdx} +0 -0
  196. /package/docs/snippets/connection/{mcp-server-rdb-ssl-requirements.mdx → ts-mcp-server-rdb-ssl-requirements.mdx} +0 -0
@@ -26,7 +26,7 @@ For Python, the [python-fastapi](https://openapi-generator.tech/docs/generators/
26
26
 
27
27
  ##### Client
28
28
 
29
- For TypeScript clients, you can use the <Link path="/guides/react-website">`ts#react-website` generator</Link> and <Link path="/guides/connection">`connection` generator</Link> with an example `ts#smithy-api` to see how clients are generated and integrated with a website. This configures build targets which generate clients by invoking our `open-api#ts-client` or `open-api#ts-hooks` generators. You can use these generators yourself by pointing them at your OpenAPI Specification.
29
+ For TypeScript clients, you can use the <Link path="/guides/react-website">`ts#website` generator</Link> and <Link path="/guides/connection">`connection` generator</Link> with an example `ts#api` (with `framework` set to `smithy`) to see how clients are generated and integrated with a website. This configures build targets which generate clients by invoking our `open-api#ts-client` or `open-api#ts-hooks` generators. You can use these generators yourself by pointing them at your OpenAPI Specification.
30
30
 
31
31
  For other languages, you can also see if any of the generators from [OpenAPI Generator](https://openapi-generator.tech/docs/generators#client-generators) fit your needs.
32
32
 
@@ -77,117 +77,11 @@ For TypeScript, check out [Smithy TypeScript](https://github.com/smithy-lang/smi
77
77
 
78
78
  Type Safe API provided a Projen project type named `SmithyShapeLibraryProject` which configured a project which contained Smithy models which could be reused by multiple Smithy-based APIs.
79
79
 
80
- The most straightforward way to achieve this is to do the following:
80
+ The equivalent is the <Link path="/guides/smithy-project">`smithy#project` generator</Link> with `type` set to `shapes`:
81
81
 
82
- ###### Create a Shape Library
82
+ <RunGenerator generator="smithy#project" requiredParameters={{ name: 'my-shapes', type: 'shapes' }} />
83
83
 
84
- <Steps>
85
-
86
- 1. Create your shape library using the `smithy#project` generator:
87
-
88
- <RunGenerator generator="smithy#project" />
89
-
90
- Specify any name for the `serviceName` option, as we will remove the `service` shape.
91
-
92
- :::note
93
- This generator is hidden at the time of writing and so you will need to execute it via the CLI.
94
- :::
95
-
96
- 1. Replace the default model in `src` with the shapes you wish to define
97
-
98
- 1. Update `smithy-build.json` to remove the `plugins` and any unused maven dependencies
99
-
100
- 1. Replace `build.Dockerfile` with minimal build steps:
101
-
102
- ```docker
103
- // build.Dockerfile
104
- FROM public.ecr.aws/docker/library/node:24 AS builder
105
-
106
- # Output directory
107
- RUN mkdir /out
108
-
109
- # Install Smithy CLI
110
- # https://smithy.io/2.0/guides/smithy-cli/cli_installation.html
111
- WORKDIR /smithy
112
- ARG TARGETPLATFORM
113
- RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then ARCH="aarch64"; else ARCH="x86_64"; fi && \
114
- mkdir -p smithy-install/smithy && \
115
- curl -L https://github.com/smithy-lang/smithy/releases/download/1.61.0/smithy-cli-linux-$ARCH.zip -o smithy-install/smithy-cli-linux-$ARCH.zip && \
116
- unzip -qo smithy-install/smithy-cli-linux-$ARCH.zip -d smithy-install && \
117
- mv smithy-install/smithy-cli-linux-$ARCH/* smithy-install/smithy
118
- RUN smithy-install/smithy/install
119
-
120
- # Copy project files
121
- COPY smithy-build.json .
122
- COPY src src
123
-
124
- # Smithy build with Maven cache mount
125
- RUN --mount=type=cache,target=/root/.m2/repository,id=maven-cache \
126
- smithy build
127
-
128
- RUN cp -r build/* /out/
129
-
130
- # Export the /out directory
131
- FROM scratch AS export
132
- COPY --from=builder /out /
133
- ```
134
-
135
- </Steps>
136
-
137
- ###### Consume the Shape Library
138
-
139
- In your service model project(s), make the following changes to consume the shape library:
140
-
141
- <Steps>
142
-
143
- 1. Update the `compile` target in `project.json` to add the workspace as build context, and a dependency on the shape library's `build` target
144
-
145
- ```json {10,15} "--build-context workspace=." "@my-project/shapes:build"
146
- // project.json
147
- {
148
- "cache": true,
149
- "outputs": ["{workspaceRoot}/dist/{projectRoot}/build"],
150
- "executor": "nx:run-commands",
151
- "options": {
152
- "commands": [
153
- "rimraf dist/packages/api/model/build",
154
- "make-dir dist/packages/api/model/build",
155
- "docker build --build-context workspace=. -f packages/api/model/build.Dockerfile --target export --output type=local,dest=dist/packages/api/model/build packages/api/model"
156
- ],
157
- "parallel": false,
158
- "cwd": "{workspaceRoot}"
159
- },
160
- "dependsOn": ["@my-project/shapes:build"]
161
- }
162
- ```
163
-
164
- 1. Update the `build.Dockerfile` to copy the `src` directory from your shape library. For example, assuming the shape library is located in `packages/shapes`:
165
-
166
- ```docker {5}
167
- // build.Dockerfile
168
- # Copy project files
169
- COPY smithy-build.json .
170
- COPY src src
171
- COPY --from=workspace packages/shapes/src shapes
172
- ```
173
-
174
- 1. Update `smithy-build.json` to add the shapes directory to its `sources`:
175
-
176
- ```json {4} "shapes/"
177
- // smithy-build.json
178
- {
179
- "version": "1.0",
180
- "sources": ["src/", "shapes/"],
181
- "plugins": {
182
- ...
183
- }
184
- ```
185
-
186
- </Steps>
187
-
188
- :::note
189
- Please express your interest on the [GitHub issue here](https://github.com/awslabs/nx-plugin-for-aws/issues/304) if you have a use case for a dedicated Smithy shape library generator.
190
- :::
84
+ Move the shapes from your `SmithyShapeLibraryProject` into the generated project's `src` folder, then refer to the <Link path="/guides/smithy-project#depending-on-a-shape-library">Smithy project guide</Link> for how to wire the library up as a dependency of your API's model.
191
85
 
192
86
  #### Interceptors
193
87
 
@@ -273,7 +167,7 @@ new MyApi(this, 'MyApi', {
273
167
 
274
168
  You will need to "stub" your service/router for your service to compile if using the `ts#smithy-api` and the TypeScript Server SDK, eg:
275
169
 
276
- ```ts {4}
170
+ ```ts {3}
277
171
  // service.ts
278
172
  export const Service: ApiService<ServiceContext> = {
279
173
  ...
@@ -10,10 +10,7 @@ import Snippet from '@components/snippet.astro';
10
10
 
11
11
  ### Recommended
12
12
 
13
- - [Docker](https://www.docker.com/) is required for some generators. [Multi-platform builds](https://docs.docker.com/build/building/multi-platform/) must be set up.
14
- - [Terraform >= 1.12](https://developer.hashicorp.com/terraform/install) is required if you choose to use this for infrastructure as code instead of CDK
15
- - verify by running `terraform --version`
16
- - 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).
13
+ <Snippet name="recommended-prerequisites" parentHeading="Recommended" />
17
14
 
18
15
  :::tip[AI Assistant Setup]
19
16
  If you use an AI Assistant such as Kiro, Kiro CLI, Cursor, Claude Code or Cline, you may also wish to <Link path="/get_started/building-with-ai">install the Nx Plugin for AWS MCP server.</Link>
@@ -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,187 @@
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` runtime configuration namespace. Include this namespace when instantiating the shared runtime configuration AppConfig application:
56
+
57
+ ```hcl title="packages/infra/src/main.tf"
58
+ module "runtime_config_appconfig" {
59
+ source = "../../common/terraform/src/core/runtime-config/appconfig"
60
+
61
+ application_name = "my-app-runtime-config"
62
+ namespaces = ["connection", "agentcore", "database"]
63
+ }
64
+ ```
65
+
66
+ The generated infrastructure creates two database users:
67
+ - **Admin user** - Created during cluster provisioning with credentials stored in AWS Secrets Manager
68
+ - **Application user** - Created via a Lambda function with IAM authentication enabled and DML privileges (SELECT, INSERT, UPDATE, DELETE) on the application database
69
+ </Fragment>
70
+ </Infrastructure>
71
+
72
+ 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.
73
+
74
+ 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.
75
+
76
+ <Drawer title="Example VPC configuration" trigger="Click here for an example VPC configuration.">
77
+
78
+ <Infrastructure>
79
+ <Fragment slot="cdk">
80
+
81
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
82
+ const vpc = new Vpc(this, 'Vpc', {
83
+ subnetConfiguration: [
84
+ {
85
+ name: 'public',
86
+ subnetType: SubnetType.PUBLIC,
87
+ },
88
+ {
89
+ name: 'private_with_egress',
90
+ subnetType: SubnetType.PRIVATE_WITH_EGRESS,
91
+ },
92
+ {
93
+ name: 'private_isolated',
94
+ subnetType: SubnetType.PRIVATE_ISOLATED,
95
+ },
96
+ ],
97
+ });
98
+ ```
99
+
100
+ </Fragment>
101
+ <Fragment slot="terraform">
102
+
103
+ ```hcl title="packages/infra/src/main.tf"
104
+ data "aws_availability_zones" "available" {
105
+ state = "available"
106
+ }
107
+
108
+ resource "aws_vpc" "main" {
109
+ cidr_block = "10.0.0.0/16"
110
+ enable_dns_hostnames = true
111
+ enable_dns_support = true
112
+ }
113
+
114
+ # Isolated subnets for the database: no route to the internet
115
+ resource "aws_subnet" "database" {
116
+ count = 2
117
+ vpc_id = aws_vpc.main.id
118
+ cidr_block = cidrsubnet(aws_vpc.main.cidr_block, 8, count.index)
119
+ availability_zone = data.aws_availability_zones.available.names[count.index]
120
+ }
121
+
122
+ # Private subnets with NAT egress for Lambda functions and runtimes,
123
+ # so they can reach AWS services such as AppConfig
124
+ resource "aws_subnet" "private" {
125
+ count = 2
126
+ vpc_id = aws_vpc.main.id
127
+ cidr_block = cidrsubnet(aws_vpc.main.cidr_block, 8, count.index + 2)
128
+ availability_zone = data.aws_availability_zones.available.names[count.index]
129
+ }
130
+
131
+ # Public subnet hosting the NAT gateway
132
+ resource "aws_subnet" "public" {
133
+ vpc_id = aws_vpc.main.id
134
+ cidr_block = cidrsubnet(aws_vpc.main.cidr_block, 8, 4)
135
+ availability_zone = data.aws_availability_zones.available.names[0]
136
+ }
137
+
138
+ resource "aws_internet_gateway" "main" {
139
+ vpc_id = aws_vpc.main.id
140
+ }
141
+
142
+ resource "aws_route_table" "public" {
143
+ vpc_id = aws_vpc.main.id
144
+
145
+ route {
146
+ cidr_block = "0.0.0.0/0"
147
+ gateway_id = aws_internet_gateway.main.id
148
+ }
149
+ }
150
+
151
+ resource "aws_route_table_association" "public" {
152
+ subnet_id = aws_subnet.public.id
153
+ route_table_id = aws_route_table.public.id
154
+ }
155
+
156
+ resource "aws_eip" "nat" {
157
+ domain = "vpc"
158
+ }
159
+
160
+ resource "aws_nat_gateway" "main" {
161
+ allocation_id = aws_eip.nat.id
162
+ subnet_id = aws_subnet.public.id
163
+ depends_on = [aws_internet_gateway.main]
164
+ }
165
+
166
+ resource "aws_route_table" "private" {
167
+ vpc_id = aws_vpc.main.id
168
+
169
+ route {
170
+ cidr_block = "0.0.0.0/0"
171
+ nat_gateway_id = aws_nat_gateway.main.id
172
+ }
173
+ }
174
+
175
+ resource "aws_route_table_association" "private" {
176
+ count = 2
177
+ subnet_id = aws_subnet.private[count.index].id
178
+ route_table_id = aws_route_table.private.id
179
+ }
180
+ ```
181
+
182
+ </Fragment>
183
+ </Infrastructure>
184
+
185
+ </Drawer>
186
+
187
+ 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,34 @@
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
+ Disable log export per database if not required:
9
+
10
+ <Infrastructure>
11
+ <Fragment slot="cdk">
12
+
13
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
14
+ import { MyDatabase } from '@my-scope/common-constructs';
15
+
16
+ const db = new MyDatabase(this, 'Db', {
17
+ ...
18
+ enableCloudwatchLogs: false,
19
+ enablePerformanceInsights: false,
20
+ });
21
+ ```
22
+ </Fragment>
23
+ <Fragment slot="terraform">
24
+
25
+ ```hcl title="packages/infra/src/main.tf"
26
+ module "my_database" {
27
+ source = "../../common/terraform/src/app/dbs/my-database"
28
+ ...
29
+ enable_cloudwatch_logs = false # disable if not required
30
+ enable_performance_insights = false # disable if not required
31
+ }
32
+ ```
33
+ </Fragment>
34
+ </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
+