@aws/nx-plugin-mcp 1.0.0-rc.7 → 1.0.0-rc.71

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 (195) hide show
  1. package/bin/aws-nx-mcp.js +12317 -10933
  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 +1301 -0
  9. package/docs/get_started/tutorials/dungeon-game/2.mdx +237 -0
  10. package/docs/get_started/tutorials/dungeon-game/3.mdx +76 -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/tutorials/existing-project.mdx +4 -0
  15. package/docs/get_started/upgrading.mdx +147 -0
  16. package/docs/guides/agentcore-gateway.mdx +490 -0
  17. package/docs/guides/agentcore-harness.mdx +275 -0
  18. package/docs/guides/astro-docs.mdx +8 -0
  19. package/docs/guides/connection/agentcore-gateway-agent.mdx +222 -0
  20. package/docs/guides/connection/agentcore-gateway-gateway.mdx +154 -0
  21. package/docs/guides/connection/agentcore-gateway-mcp.mdx +134 -0
  22. package/docs/guides/connection/py-agent-a2a.mdx +48 -16
  23. package/docs/guides/connection/py-agent-dynamodb.mdx +116 -0
  24. package/docs/guides/connection/py-agent-gateway.mdx +178 -0
  25. package/docs/guides/connection/py-agent-mcp.mdx +43 -14
  26. package/docs/guides/connection/py-agent-rdb.mdx +178 -0
  27. package/docs/guides/connection/py-fast-api-dynamodb.mdx +56 -0
  28. package/docs/guides/connection/py-fast-api-rdb.mdx +184 -0
  29. package/docs/guides/connection/py-mcp-server-dynamodb.mdx +116 -0
  30. package/docs/guides/connection/py-mcp-server-rdb.mdx +187 -0
  31. package/docs/guides/connection/react-agentcore-gateway.mdx +112 -0
  32. package/docs/guides/connection/react-agui.mdx +13 -13
  33. package/docs/guides/connection/react-fastapi.mdx +38 -2
  34. package/docs/guides/connection/react-py-agent.mdx +9 -15
  35. package/docs/guides/connection/react-smithy.mdx +3 -3
  36. package/docs/guides/connection/react-trpc.mdx +1 -1
  37. package/docs/guides/connection/react-ts-agent.mdx +8 -8
  38. package/docs/guides/connection/smithy-dynamodb.mdx +5 -5
  39. package/docs/guides/connection/smithy-rdb.mdx +9 -9
  40. package/docs/guides/connection/trpc-dynamodb.mdx +5 -5
  41. package/docs/guides/connection/trpc-rdb.mdx +6 -6
  42. package/docs/guides/connection/ts-agent-a2a.mdx +14 -11
  43. package/docs/guides/connection/ts-agent-dynamodb.mdx +5 -5
  44. package/docs/guides/connection/ts-agent-gateway.mdx +143 -0
  45. package/docs/guides/connection/ts-agent-mcp.mdx +12 -9
  46. package/docs/guides/connection/ts-agent-rdb.mdx +70 -25
  47. package/docs/guides/connection/ts-mcp-server-dynamodb.mdx +5 -5
  48. package/docs/guides/connection/ts-mcp-server-rdb.mdx +68 -18
  49. package/docs/guides/connection.mdx +122 -5
  50. package/docs/guides/docker-bundling.mdx +69 -12
  51. package/docs/guides/fastapi.mdx +249 -9
  52. package/docs/guides/local-development.mdx +87 -0
  53. package/docs/guides/nx-generator.mdx +4 -3
  54. package/docs/guides/nx-migration.mdx +165 -0
  55. package/docs/guides/py-agent.mdx +264 -49
  56. package/docs/guides/py-dynamodb.mdx +476 -0
  57. package/docs/guides/py-mcp-server.mdx +61 -2
  58. package/docs/guides/py-rdb.mdx +265 -0
  59. package/docs/guides/python-lambda-function.mdx +1 -1
  60. package/docs/guides/react-website-auth.mdx +65 -4
  61. package/docs/guides/react-website.mdx +149 -30
  62. package/docs/guides/runtime-config.mdx +1 -1
  63. package/docs/guides/security.mdx +75 -0
  64. package/docs/guides/smithy-project.mdx +167 -0
  65. package/docs/guides/terraform-project.mdx +2 -2
  66. package/docs/guides/trpc.mdx +53 -16
  67. package/docs/guides/ts-agent.mdx +183 -10
  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 +109 -29
  72. package/docs/guides/ts-nx-plugin.mdx +3 -3
  73. package/docs/guides/ts-rdb.mdx +113 -467
  74. package/docs/guides/ts-smithy-api.mdx +258 -18
  75. package/docs/guides/typescript-infrastructure.mdx +46 -24
  76. package/docs/guides/typescript-project.mdx +134 -27
  77. package/docs/guides/workspace.mdx +10 -3
  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 +33 -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 +33 -2
  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 +1 -1
  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 +51 -19
  93. package/docs/snippets/dynamodb/deploying-table.mdx +166 -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/pdk-migration/example/01-migrate-api.mdx +7 -5
  103. package/docs/snippets/pdk-migration/example/02-migrate-website.mdx +29 -10
  104. package/docs/snippets/pdk-migration/example/03-migrate-infra.mdx +4 -4
  105. package/docs/snippets/pdk-migration/faq/type-safe-api.mdx +5 -111
  106. package/docs/snippets/prerequisites.mdx +1 -4
  107. package/docs/snippets/rdb/architecture.mdx +38 -0
  108. package/docs/snippets/rdb/cluster-instances.mdx +31 -0
  109. package/docs/snippets/rdb/deletion-protection.mdx +34 -0
  110. package/docs/snippets/rdb/deploying.mdx +187 -0
  111. package/docs/snippets/rdb/encryption-key-rotation.mdx +30 -0
  112. package/docs/snippets/rdb/engine-version.mdx +63 -0
  113. package/docs/snippets/rdb/infrastructure.mdx +35 -0
  114. package/docs/snippets/rdb/logging-mysql.mdx +5 -0
  115. package/docs/snippets/rdb/logging-postgres.mdx +5 -0
  116. package/docs/snippets/rdb/performance-insights.mdx +34 -0
  117. package/docs/snippets/rdb/rds-proxy.mdx +50 -0
  118. package/docs/snippets/rdb/removal-policy.mdx +57 -0
  119. package/docs/snippets/rdb/serverless-capacity.mdx +32 -0
  120. package/docs/snippets/recommended-prerequisites.mdx +10 -0
  121. package/docs/snippets/required-prerequisites.mdx +1 -4
  122. package/docs/snippets/runtime-config-app-id-note.mdx +8 -0
  123. package/docs/snippets/shared-constructs.mdx +1 -1
  124. package/docs/snippets/trivy-image-scan.mdx +37 -0
  125. package/generators.json +152 -10
  126. package/package.json +1 -1
  127. package/src/agentcore-gateway/agent-connection/schema.json +31 -0
  128. package/src/agentcore-gateway/gateway-connection/schema.json +31 -0
  129. package/src/agentcore-gateway/mcp-connection/schema.json +31 -0
  130. package/src/agentcore-gateway/react-connection/schema.json +31 -0
  131. package/src/agentcore-gateway/schema.json +72 -0
  132. package/src/agentcore-harness/schema.json +53 -0
  133. package/src/connection/schema.json +5 -0
  134. package/src/infra/app/schema.json +5 -0
  135. package/src/init/schema.json +35 -0
  136. package/src/internal/test-matrix/schema.json +21 -0
  137. package/src/license/schema.json +5 -0
  138. package/src/preset/schema.json +16 -5
  139. package/src/py/agent/a2a-connection/schema.json +5 -0
  140. package/src/py/agent/gateway-connection/schema.json +31 -0
  141. package/src/py/agent/mcp-connection/schema.json +5 -0
  142. package/src/py/agent/react-connection/schema.json +5 -0
  143. package/src/py/agent/schema.json +15 -1
  144. package/src/py/api/schema.json +5 -0
  145. package/src/py/dynamodb/agent-connection/schema.json +27 -0
  146. package/src/py/dynamodb/fast-api-connection/schema.json +23 -0
  147. package/src/py/dynamodb/mcp-server-connection/schema.json +27 -0
  148. package/src/py/dynamodb/schema.json +76 -0
  149. package/src/py/fast-api/react/schema.json +5 -0
  150. package/src/py/fast-api/schema.json +6 -0
  151. package/src/py/lambda-function/schema.json +5 -0
  152. package/src/py/mcp-server/schema.json +6 -0
  153. package/src/py/project/schema.json +5 -0
  154. package/src/py/rdb/agent-connection/schema.json +27 -0
  155. package/src/py/rdb/fast-api-connection/schema.json +23 -0
  156. package/src/py/rdb/mcp-server-connection/schema.json +27 -0
  157. package/src/py/rdb/schema.json +78 -0
  158. package/src/smithy/project/schema.json +28 -1
  159. package/src/smithy/react-connection/schema.json +5 -0
  160. package/src/smithy/ts/api/schema.json +6 -0
  161. package/src/terraform/project/schema.json +5 -0
  162. package/src/trpc/backend/schema.json +6 -0
  163. package/src/trpc/react/schema.json +5 -0
  164. package/src/ts/agent/a2a-connection/schema.json +5 -0
  165. package/src/ts/agent/gateway-connection/schema.json +31 -0
  166. package/src/ts/agent/mcp-connection/schema.json +5 -0
  167. package/src/ts/agent/react-connection/schema.json +5 -0
  168. package/src/ts/agent/schema.json +14 -0
  169. package/src/ts/api/schema.json +5 -0
  170. package/src/ts/astro-docs/schema.json +3 -3
  171. package/src/ts/dcr-proxy/schema.json +44 -0
  172. package/src/ts/docs/schema.json +3 -3
  173. package/src/ts/dynamodb/agent-connection/schema.json +5 -0
  174. package/src/ts/dynamodb/mcp-server-connection/schema.json +5 -0
  175. package/src/ts/dynamodb/schema.json +26 -2
  176. package/src/ts/dynamodb/smithy-connection/schema.json +5 -0
  177. package/src/ts/dynamodb/trpc-connection/schema.json +5 -0
  178. package/src/ts/lambda-function/schema.json +5 -0
  179. package/src/ts/lib/schema.json +5 -0
  180. package/src/ts/mcp-server/schema.json +6 -0
  181. package/src/ts/nx-generator/schema.json +5 -0
  182. package/src/ts/nx-migration/schema.json +63 -0
  183. package/src/ts/nx-plugin/schema.json +5 -0
  184. package/src/ts/rdb/agent-connection/schema.json +5 -0
  185. package/src/ts/rdb/mcp-server-connection/schema.json +5 -0
  186. package/src/ts/rdb/schema.json +7 -1
  187. package/src/ts/rdb/smithy-connection/schema.json +5 -0
  188. package/src/ts/rdb/trpc-connection/schema.json +5 -0
  189. package/src/ts/react-website/app/schema.json +12 -6
  190. package/src/ts/react-website/cognito-auth/schema.json +5 -0
  191. package/src/ts/react-website/runtime-config/schema.json +5 -0
  192. package/src/ts/website/app/schema.json +11 -6
  193. package/src/ts/website/auth/schema.json +5 -0
  194. /package/docs/snippets/connection/{lambda-rdb-ssl-requirements.mdx → ts-lambda-rdb-ssl-requirements.mdx} +0 -0
  195. /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
 
@@ -11,7 +12,7 @@ To allow your API to connect to the database at runtime, the API Lambda function
11
12
  In your application stack, deploy the API into the same VPC as the database, then call `allowDefaultPortFrom` and `grantConnect` to open the network path and grant IAM `rds-db:connect` permission to each Lambda handler:
12
13
 
13
14
  ```ts title="packages/infra/src/stacks/application-stack.ts"
14
- import { MyDatabase } from ':my-scope/common-constructs';
15
+ import { MyDatabase } from '@my-scope/common-constructs';
15
16
 
16
17
  const db = new MyDatabase(this, 'Db', { vpc, ... });
17
18
 
@@ -39,34 +40,65 @@ 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. The `aws_vpc.main` and `aws_subnet` resources are defined in the database deployment guide:
43
44
 
44
45
  ```hcl title="packages/infra/src/main.tf"
45
46
  module "my_database" {
46
47
  source = "../../common/terraform/src/app/dbs/my-database"
47
- vpc_id = module.vpc.vpc_id
48
- database_subnet_ids = module.vpc.private_isolated_subnet_ids
49
- lambda_subnet_ids = module.vpc.private_subnet_ids
48
+ vpc_id = aws_vpc.main.id
49
+ database_subnet_ids = aws_subnet.database[*].id
50
+ lambda_subnet_ids = aws_subnet.private[*].id
50
51
  }
51
52
 
52
53
  module "api" {
53
- source = "..."
54
- vpc_id = module.vpc.vpc_id
55
- private_subnet_ids = module.vpc.private_subnet_ids
56
-
57
- appconfig_application_id = module.my_database.appconfig_application_id
58
- database_cluster_resource_id = module.my_database.cluster_resource_id
59
- database_runtime_user = module.my_database.database_runtime_user
60
- database_security_group_id = module.my_database.security_group_id
61
- database_port = module.my_database.cluster_port
62
-
63
- environment_variables = {
64
- RUNTIME_CONFIG_APP_ID = module.my_database.appconfig_application_id
65
- }
54
+ source = "../../common/terraform/src/app/apis/my-api"
55
+ enable_vpc = true
56
+ vpc_id = aws_vpc.main.id
57
+ subnet_ids = aws_subnet.private[*].id
58
+
59
+ appconfig_application_id = module.runtime_config_appconfig.application_id
60
+ appconfig_application_arn = module.runtime_config_appconfig.application_arn
61
+
62
+ additional_iam_policy_statements = [
63
+ {
64
+ Effect = "Allow"
65
+ Action = ["rds-db:connect"]
66
+ Resource = [
67
+ "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}"
68
+ ]
69
+ }
70
+ ]
71
+ }
72
+
73
+ resource "aws_vpc_security_group_ingress_rule" "api_to_database" {
74
+ description = "Allow the API Lambda functions to connect to the 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
+ description = "Allow outbound traffic from the API Lambda functions to the database"
84
+ security_group_id = module.api.security_group_id
85
+ referenced_security_group_id = module.my_database.security_group_id
86
+ from_port = module.my_database.cluster_port
87
+ to_port = module.my_database.cluster_port
88
+ ip_protocol = "tcp"
66
89
  }
67
90
  ```
68
91
 
69
- 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.
92
+ Deploy the API Lambda functions into **private subnets with egress**, not private isolated subnets. `appconfig_application_id`/`appconfig_application_arn` come from the shared <Link path="guides/runtime-config">runtime configuration</Link> AppConfig application declared once in your root module, not from the database module — passing them sets `RUNTIME_CONFIG_APP_ID` on the Lambda functions and grants them read access to the application. Include the `database` namespace when instantiating it so the database module's runtime configuration entry is deployed:
93
+
94
+ ```hcl title="packages/infra/src/main.tf"
95
+ module "runtime_config_appconfig" {
96
+ source = "../../common/terraform/src/core/runtime-config/appconfig"
97
+
98
+ application_name = "my-app-runtime-config"
99
+ namespaces = ["connection", "agentcore", "database"]
100
+ }
101
+ ```
70
102
 
71
103
  </Fragment>
72
104
  </Infrastructure>
@@ -0,0 +1,166 @@
1
+ ---
2
+ title: Deploying your DynamoDB Table
3
+ ---
4
+ import Infrastructure from '@components/infrastructure.astro';
5
+
6
+ The DynamoDB generator creates CDK or Terraform infrastructure based on your selected `iac`.
7
+
8
+ <Infrastructure>
9
+ <Fragment slot="cdk">
10
+ The CDK construct is created in `common/constructs`. Example usage:
11
+
12
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
13
+ import { MyTable } from '@my-scope/common-constructs';
14
+
15
+ export class ApplicationStack extends Stack {
16
+ constructor(scope: Construct, id: string, props?: StackProps) {
17
+ super(scope, id, props);
18
+
19
+ const table = new MyTable(this, 'Table');
20
+ }
21
+ }
22
+ ```
23
+
24
+ This provisions a DynamoDB table with:
25
+ - `pk` (partition key) and `sk` (sort key), both `String` type
26
+ - Global Secondary Indexes as defined in `config.json`
27
+ - On-demand (`PAY_PER_REQUEST`) billing
28
+ - Customer-managed KMS encryption with automatic key rotation
29
+ - Point-in-time recovery enabled
30
+ - Deletion protection enabled
31
+ - Table name registered in Runtime Config under the `dynamodb` namespace in AWS AppConfig
32
+ </Fragment>
33
+ <Fragment slot="terraform">
34
+ The Terraform module is created in `common/terraform`. Example usage:
35
+
36
+ ```hcl title="packages/infra/src/main.tf"
37
+ module "my_table" {
38
+ source = "../../common/terraform/src/app/dynamodb/my-table"
39
+ }
40
+ ```
41
+
42
+ This provisions a DynamoDB table with:
43
+ - `pk` (partition key) and `sk` (sort key), both `String` type
44
+ - Global Secondary Indexes as defined in `config.json`
45
+ - On-demand (`PAY_PER_REQUEST`) billing
46
+ - Customer-managed KMS encryption with automatic key rotation
47
+ - Point-in-time recovery enabled
48
+ - Deletion protection enabled
49
+ - Table name registered in Runtime Config
50
+ </Fragment>
51
+ </Infrastructure>
52
+
53
+ ### Deletion Protection
54
+
55
+ Deletion protection is enabled by default to prevent accidental table deletion.
56
+
57
+ #### Disable Deletion Protection
58
+
59
+ Disable it for environments where table deletion is expected, such as short-lived development or preview stacks.
60
+
61
+ <Infrastructure>
62
+ <Fragment slot="cdk">
63
+
64
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
65
+ import { MyTable } from '@my-scope/common-constructs';
66
+
67
+ const table = new MyTable(this, 'Table', {
68
+ deletionProtection: false,
69
+ });
70
+ ```
71
+ </Fragment>
72
+ <Fragment slot="terraform">
73
+
74
+ ```hcl title="packages/infra/src/main.tf"
75
+ module "my_table" {
76
+ source = "../../common/terraform/src/app/dynamodb/my-table"
77
+ deletion_protection_enabled = false
78
+ }
79
+ ```
80
+ </Fragment>
81
+ </Infrastructure>
82
+
83
+ ### Billing Mode
84
+
85
+ The table defaults to on-demand (`PAY_PER_REQUEST`) billing. Switch to provisioned capacity for predictable, high-throughput workloads.
86
+
87
+ <Infrastructure>
88
+ <Fragment slot="cdk">
89
+
90
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
91
+ import { BillingMode } from 'aws-cdk-lib/aws-dynamodb';
92
+ import { MyTable } from '@my-scope/common-constructs';
93
+
94
+ const table = new MyTable(this, 'Table', {
95
+ billingMode: BillingMode.PROVISIONED,
96
+ readCapacity: 5,
97
+ writeCapacity: 5,
98
+ });
99
+ ```
100
+ </Fragment>
101
+ <Fragment slot="terraform">
102
+
103
+ ```hcl title="packages/infra/src/main.tf"
104
+ module "my_table" {
105
+ source = "../../common/terraform/src/app/dynamodb/my-table"
106
+ billing_mode = "PROVISIONED"
107
+ }
108
+ ```
109
+ </Fragment>
110
+ </Infrastructure>
111
+
112
+ ### Point-in-time Recovery
113
+
114
+ [Point-in-time recovery](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Point-in-time-recovery.html) is enabled by default, allowing you to restore the table to any point in the last 35 days.
115
+
116
+ #### Disable Point-in-time Recovery
117
+
118
+ <Infrastructure>
119
+ <Fragment slot="cdk">
120
+
121
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
122
+ import { MyTable } from '@my-scope/common-constructs';
123
+
124
+ const table = new MyTable(this, 'Table', {
125
+ pointInTimeRecoverySpecification: { pointInTimeRecoveryEnabled: false },
126
+ });
127
+ ```
128
+ </Fragment>
129
+ <Fragment slot="terraform">
130
+
131
+ ```hcl title="packages/infra/src/main.tf"
132
+ module "my_table" {
133
+ source = "../../common/terraform/src/app/dynamodb/my-table"
134
+ point_in_time_recovery_enabled = false
135
+ }
136
+ ```
137
+ </Fragment>
138
+ </Infrastructure>
139
+
140
+ ### Encryption Key Rotation
141
+
142
+ The KMS key used to encrypt the table has automatic key rotation enabled by default. Disable it if your security policy manages rotation externally.
143
+
144
+ #### Disable Encryption Key Rotation
145
+
146
+ <Infrastructure>
147
+ <Fragment slot="cdk">
148
+
149
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
150
+ import { MyTable } from '@my-scope/common-constructs';
151
+
152
+ const table = new MyTable(this, 'Table', {
153
+ enableKeyRotation: false,
154
+ });
155
+ ```
156
+ </Fragment>
157
+ <Fragment slot="terraform">
158
+
159
+ ```hcl title="packages/infra/src/main.tf"
160
+ module "my_table" {
161
+ source = "../../common/terraform/src/app/dynamodb/my-table"
162
+ enable_key_rotation = false
163
+ }
164
+ ```
165
+ </Fragment>
166
+ </Infrastructure>
@@ -0,0 +1,38 @@
1
+ ---
2
+ title: GSI Configuration
3
+ ---
4
+
5
+ ```json title="config.json"
6
+ {
7
+ ...
8
+ "tableConfig": {
9
+ "globalSecondaryIndexes": [
10
+ {
11
+ "indexName": "gsi1pk-gsi1sk-index",
12
+ "partitionKey": "gsi1pk",
13
+ "sortKey": "gsi1sk"
14
+ },
15
+ {
16
+ "indexName": "gsi2pk-gsi2sk-index",
17
+ "partitionKey": "gsi2pk",
18
+ "sortKey": "gsi2sk"
19
+ }
20
+ ]
21
+ }
22
+ }
23
+ ```
24
+
25
+ The `sortKey` field is optional for hash-key-only GSIs.
26
+
27
+ This config file is the single source of truth read by all consumers:
28
+ - **Local development** — `dev` reads `config.json` and creates or updates the local table to match the GSI list
29
+ - **CDK** — the construct reads `config.json` at synth time, so GSI changes are reflected on the next `cdk deploy`
30
+ - **Terraform** — the module reads `config.json` at plan/apply time
31
+
32
+ ### One GSI per Deployment
33
+
34
+ :::caution
35
+ DynamoDB [does not allow more than one GSI to be created or deleted in a single table update](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.OnlineOps.html).
36
+
37
+ Each deployment can add or remove **at most one GSI**. If you need to add or remove multiple GSIs, do so one at a time — update `config.json` and relevant entity classes, deploy the stack, then repeat for the next change.
38
+ :::
@@ -0,0 +1,33 @@
1
+ ---
2
+ title: DynamoDB 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
+ - dynamodb
16
+ - \<name>.ts Infrastructure specific to your table
17
+ - core
18
+ - dynamodb.ts Generic DynamoDB table construct
19
+ </FileTree>
20
+ </Fragment>
21
+ <Fragment slot="terraform">
22
+ <FileTree>
23
+ - packages/common/terraform/src
24
+ - app
25
+ - dynamodb
26
+ - \<name>
27
+ - \<name>.tf Module specific to your table
28
+ - core
29
+ - dynamodb
30
+ - dynamodb.tf Generic DynamoDB module
31
+ </FileTree>
32
+ </Fragment>
33
+ </Infrastructure>
@@ -0,0 +1,13 @@
1
+ ---
2
+ title: Starting Local DynamoDB
3
+ ---
4
+ import NxCommands from '@components/nx-commands.astro';
5
+
6
+ The generator configures a `dev` target that starts a [DynamoDB Local](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html) instance and creates the table. Use the project's `dev` target:
7
+
8
+ <NxCommands commands={['dev <project-name>']} />
9
+
10
+ This automatically:
11
+ 1. Pulls the DynamoDB Local image (`pull-image` target)
12
+ 2. Starts a container
13
+ 3. Creates a local table with the indexes defined in `config.json`
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: Local Development Windows Caution
3
+ ---
4
+
5
+ Stopping `dev` (e.g. with `Ctrl+C`) automatically removes the DynamoDB Local container, but preserves the named volume so your data persists across restarts.
6
+
7
+ :::caution[Windows]
8
+ Due to limitations with signal handling on Windows, the container is not automatically removed when `dev` is stopped. You will need to remove it manually:
9
+
10
+ ```bash
11
+ <engine> rm -f <scope>-dynamodb
12
+ ```
13
+
14
+ Replace `<engine>` with your container engine (`docker` or `finch`) and `<scope>` with your Nx workspace scope (e.g. `proj`).
15
+ :::
@@ -3,14 +3,14 @@ title: Deploying your Function
3
3
  ---
4
4
  import Infrastructure from '@components/infrastructure.astro';
5
5
 
6
- This generator creates CDK or Terraform infrastructure as code based on your selected `iacProvider`. You can use this to deploy your function.
6
+ This generator creates CDK or Terraform infrastructure as code based on your selected `iac`. You can use this to deploy your function.
7
7
 
8
8
  <Infrastructure>
9
9
  <Fragment slot="cdk">
10
10
  This generator creates a CDK construct for deploying your function in the `common/constructs` folder. You can use this in a CDK application:
11
11
 
12
12
  ```typescript {1, 6}
13
- import { MyProjectMyFunction } from ':my-scope/common-constructs';
13
+ import { MyProjectMyFunction } from '@my-scope/common-constructs';
14
14
 
15
15
  export class ExampleStack extends Stack {
16
16
  constructor(scope: Construct, id: string) {
@@ -38,7 +38,7 @@ The example below demonstrates the CDK code for invoking your lambda function on
38
38
  ```typescript
39
39
  import { Rule, Schedule } from 'aws-cdk-lib/aws-events';
40
40
  import { LambdaFunction } from 'aws-cdk-lib/aws-events-targets';
41
- import { MyProjectMyFunction } from ':my-scope/common-constructs';
41
+ import { MyProjectMyFunction } from '@my-scope/common-constructs';
42
42
 
43
43
  export class ExampleStack extends Stack {
44
44
  constructor(scope: Construct, id: string) {
@@ -23,7 +23,7 @@ ecr: ECR {
23
23
 
24
24
  agentcore: MCP Server\n(AgentCore Runtime) {
25
25
  shape: image
26
- icon: /nx-plugin-for-aws/icons/aws/bedrock-agentcore.svg
26
+ icon: /nx-plugin-for-aws/icons/aws/bedrock-agentcore-runtime.svg
27
27
  }
28
28
 
29
29
  cw: CloudWatch\n(Logs, Metrics) {
@@ -15,7 +15,7 @@ A CDK construct is generated for your MCP Server, named based on the `name` you
15
15
  You can use this CDK construct in a CDK application:
16
16
 
17
17
  ```ts {6}
18
- import { MyProjectMcpServer } from ':my-scope/common-constructs';
18
+ import { MyProjectMcpServer } from '@my-scope/common-constructs';
19
19
 
20
20
  export class ExampleStack extends Stack {
21
21
  constructor(scope: Construct, id: string) {
@@ -64,7 +64,7 @@ By default, your MCP server will be secured using IAM authentication, simply dep
64
64
  <Infrastructure>
65
65
  <Fragment slot="cdk">
66
66
  ```ts {5}
67
- import { MyProjectMcpServer } from ':my-scope/common-constructs';
67
+ import { MyProjectMcpServer } from '@my-scope/common-constructs';
68
68
 
69
69
  export class ExampleStack extends Stack {
70
70
  constructor(scope: Construct, id: string) {
@@ -76,7 +76,7 @@ export class ExampleStack extends Stack {
76
76
  You can grant access to invoke your MCP server on Bedrock AgentCore Runtime using the `grantInvokeAccess` method. For example you may wish for an agent generated with the <Link path="/guides/py-agent">`py#agent`</Link> generator to call your MCP server:
77
77
 
78
78
  ```ts {8}
79
- import { MyProjectAgent, MyProjectMcpServer } from ':my-scope/common-constructs';
79
+ import { MyProjectAgent, MyProjectMcpServer } from '@my-scope/common-constructs';
80
80
 
81
81
  export class ExampleStack extends Stack {
82
82
  constructor(scope: Construct, id: string) {
@@ -126,7 +126,7 @@ When you select `Cognito` authentication, the generator configures the MCP serve
126
126
  The generated construct accepts an `identity` prop which configures Cognito authentication:
127
127
 
128
128
  ```ts {8}
129
- import { MyProjectMcpServer, UserIdentity } from ':my-scope/common-constructs';
129
+ import { MyProjectMcpServer, UserIdentity } from '@my-scope/common-constructs';
130
130
 
131
131
  export class ExampleStack extends Stack {
132
132
  constructor(scope: Construct, id: string) {
@@ -144,7 +144,7 @@ The `UserIdentity` construct can be generated using the <Link path="/guides/reac
144
144
  <Fragment slot="terraform">
145
145
  The generated module accepts `user_pool_id` and `user_pool_client_ids` variables for Cognito authentication:
146
146
 
147
- ```terraform {8-9}
147
+ ```terraform {11-12}
148
148
  module "user_identity" {
149
149
  source = "../../common/terraform/src/core/user-identity"
150
150
  }
@@ -164,4 +164,8 @@ module "my_project_mcp_server" {
164
164
 
165
165
  :::note[Custom OIDC Providers]
166
166
  If you require custom JWT authentication with a non-Cognito OIDC provider, you can modify the generated CDK construct or Terraform module for your MCP server directly. Note that the connection generator will only support `IAM` or `Cognito` authentication.
167
+ :::
168
+
169
+ :::caution[Security Best Practices]
170
+ When implementing your MCP server's business logic, review the [Bedrock AgentCore Runtime security best practices](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-security-best-practices.html).
167
171
  :::
@@ -1,13 +1,14 @@
1
1
  ---
2
2
  title: MCP Server Configuration
3
3
  ---
4
+
4
5
  ```json {3-6}
5
6
  {
6
7
  "mcpServers": {
7
8
  "nx-plugin-for-aws": {
8
9
  "command": "npx",
9
- "args": ["-y", "@aws/nx-plugin-mcp@next"]
10
+ "args": ["-y", "@aws/nx-plugin-mcp"]
10
11
  }
11
12
  }
12
13
  }
13
- ```
14
+ ```
@@ -23,9 +23,9 @@ If you used OpenAPI or TypeSpec as your modelling language, or have handlers imp
23
23
 
24
24
  #### Generate a TypeScript Smithy API
25
25
 
26
- Run the <Link path="/guides/ts-smithy-api">`ts#smithy-api` generator</Link> to set up your api project in `packages/api`:
26
+ Run the <Link path="/guides/ts-smithy-api">`ts#api` generator</Link> with `framework` set to `smithy` to set up your api project in `packages/api`:
27
27
 
28
- <RunGenerator generator="ts#smithy-api" noInteractive requiredParameters={{ name: 'api', namespace: 'com.aws', auth: 'IAM' }} />
28
+ <RunGenerator generator="ts#api" noInteractive requiredParameters={{ name: 'api', framework: 'smithy', namespace: 'com.aws', auth: 'iam' }} />
29
29
 
30
30
  You will notice this generates a `model` project, as well as a `backend` project. The `model` project contains your Smithy model, and `backend` contains your server implementation.
31
31
 
@@ -128,12 +128,14 @@ You can consider the `api/backend` project as somewhat equivalent to Type Safe A
128
128
 
129
129
  One of the main differences between Type Safe API and the `ts#smithy-api` generator is that handlers are implemented using the [Smithy Server Generator for TypeScript](https://smithy.io/2.0/languages/typescript/ts-ssdk/index.html), rather than Type Safe API's own generated handler wrappers (found in the `api/generated/typescript/runtime` project).
130
130
 
131
- The shopping list application's lambda handlers rely on the `@aws-sdk/client-dynamodb` package, so let's install that first:
131
+ The shopping list application's lambda handlers rely on the `@aws-sdk/client-dynamodb` package, so let's install that into the `@shopping-list/api` project:
132
132
 
133
- <InstallCommand pkg="@aws-sdk/client-dynamodb" />
133
+ <InstallCommand pkg="@aws-sdk/client-dynamodb" project="@shopping-list/api" />
134
134
 
135
135
  Then, let's copy the `handlers/src/dynamo-client.ts` file from the PDK project to `backend/src/operations` so it's available for our handlers.
136
136
 
137
+ The `ts#smithy-api` generator scaffolds an example `Echo` operation. Since we removed this from our model, delete the corresponding handler in `backend/src/operations/echo.ts`. We'll register our migrated operations in `service.ts` further below.
138
+
137
139
  To migrate the handlers, you can follow these general steps:
138
140
 
139
141
  <Steps>
@@ -583,7 +585,7 @@ Additionally, update `packages/api/backend/project.json` and update `metadata.ap
583
585
  "generator": "ts#smithy-api",
584
586
  - "apiName": "api",
585
587
  + "apiName": "my-api",
586
- "auth": "IAM",
588
+ "auth": "iam",
587
589
  "modelProject": "@shopping-list/api-model",
588
590
  "ports": [3001]
589
591
  },
@@ -11,21 +11,21 @@ import InstallCommand from '@components/install-command.astro';
11
11
 
12
12
  The `CloudscapeReactTsWebsiteProject` used in the shopping list application configured a React website with CloudScape and Cognito authentication built in.
13
13
 
14
- This project type leveraged [`create-react-app`](https://github.com/facebook/create-react-app), which is now deprecated. For migrating the website in this guide, we will use the <Link path="/guides/react-website">`ts#react-website` generator</Link>, which uses more modern and supported technologies, namely [Vite](https://vite.dev/).
14
+ This project type leveraged [`create-react-app`](https://github.com/facebook/create-react-app), which is now deprecated. For migrating the website in this guide, we will use the <Link path="/guides/react-website">`ts#website` generator</Link>, which uses more modern and supported technologies, namely [Vite](https://vite.dev/).
15
15
 
16
16
  As part of the migration, we will also move from PDK's configured React Router to [TanStack Router](https://tanstack.com/router), which adds additional type-safety to website routing.
17
17
 
18
18
  #### Generate a React Website
19
19
 
20
- Run the <Link path="/guides/react-website">`ts#react-website` generator</Link> to set up your website project in `packages/website`:
20
+ Run the <Link path="/guides/react-website">`ts#website` generator</Link> with `framework` set to `react` to set up your website project in `packages/website`. Since the shopping list application is built with CloudScape components, we also set `ux` to `cloudscape` (the default is `shadcn`):
21
21
 
22
- <RunGenerator generator="ts#react-website" noInteractive requiredParameters={{ name: 'website' }} />
22
+ <RunGenerator generator="ts#website" noInteractive requiredParameters={{ name: 'website', framework: 'react', ux: 'cloudscape' }} />
23
23
 
24
24
  #### Add Cognito Authentication
25
25
 
26
- The React website generator above doesn't bundle cognito authentication by default like `CloudscapeReactTsWebsiteProject`, instead it's added explicitly via the <Link path="/guides/react-website-auth">`ts#react-website#auth` generator</Link>.
26
+ The React website generator above doesn't bundle cognito authentication by default like `CloudscapeReactTsWebsiteProject`, instead it's added explicitly via the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link>.
27
27
 
28
- <RunGenerator generator="ts#react-website#auth" noInteractive requiredParameters={{ project: 'website', cognitoDomain: 'shopping-list' }} />
28
+ <RunGenerator generator="ts#website#auth" noInteractive requiredParameters={{ project: 'website', cognitoDomain: 'shopping-list' }} />
29
29
 
30
30
  This adds React components which manage the appropriate redirects to ensure users log in using the Cognito hosted UI. This also adds a CDK construct to deploy the Cognito resources in `packages/common/constructs`, called `UserIdentity`.
31
31
 
@@ -57,9 +57,26 @@ This generates the necessary client providers and build targets for your website
57
57
 
58
58
  #### Add AWS Northstar Dependency
59
59
 
60
- The `CloudscapeReactTsWebsiteProject` automatically included a dependency on `@aws-northstar/ui` which is used in our shopping list application, so we add it here:
60
+ The `CloudscapeReactTsWebsiteProject` automatically included a dependency on `@aws-northstar/ui` which is used in our shopping list application, so we add it to the `@shopping-list/website` project:
61
61
 
62
- <InstallCommand pkg="@aws-northstar/ui" />
62
+ <InstallCommand pkg="@aws-northstar/ui" project="@shopping-list/website" />
63
+
64
+ `@aws-northstar/ui` bundles a code editor component which depends on `ace-builds`, using a webpack-specific import that Vite cannot resolve. Since our shopping list application doesn't use this component, we exclude it from the bundle by adding it to the `external` configuration within the existing `build` options in `packages/website/vite.config.mts`:
65
+
66
+ ```diff lang="ts"
67
+ // packages/website/vite.config.mts
68
+ build: {
69
+ outDir: '../../dist/packages/website/bundle',
70
+ emptyOutDir: true,
71
+ reportCompressedSize: true,
72
+ commonjsOptions: {
73
+ transformMixedEsModules: true,
74
+ },
75
+ + rollupOptions: {
76
+ + external: ['ace-builds/webpack-resolver'],
77
+ + },
78
+ },
79
+ ```
63
80
 
64
81
  #### Move the Components and Pages
65
82
 
@@ -79,12 +96,14 @@ Note that you'll now have some build errors visible in your IDE, we'll need to m
79
96
 
80
97
  #### Migrate from React Router to TanStack Router
81
98
 
82
- Since we're using [file-based routing](https://tanstack.com/router/latest/docs/framework/react/routing/file-based-routing), we can use the website local development server to manage automatically generating route configuration. Let's start the local website server:
99
+ Since we're using [file-based routing](https://tanstack.com/router/latest/docs/framework/react/routing/file-based-routing), we can use the website local development server to manage automatically generating route configuration.
100
+
101
+ Let's start the local website server:
83
102
 
84
- <NxCommands commands={["serve-local website"]} />
103
+ <NxCommands commands={["dev website"]} />
85
104
 
86
105
  :::tip
87
- We're using the `serve-local` target here, which also starts local servers for any APIs which have been connected with `connection`, and hot-reloads if your website, model, or backend changes! This allows us to test our API and website locally before we've even written any CDK code.
106
+ We're using the `dev` target here, which also starts local servers for any APIs which have been connected with `connection`, and hot-reloads if your website, model, or backend changes! This allows us to test our API and website locally before we've even written any CDK code.
88
107
  :::
89
108
 
90
109
  You'll see some errors, but the local website server should start on port `4200`, as well as the local Smithy API server on port `3001`.
@@ -46,7 +46,7 @@ Since the Nx Plugin for AWS uses [Checkov](https://www.checkov.io/) for security
46
46
 
47
47
  ```diff lang="ts"
48
48
  // constructs/database.ts
49
- +import { suppressRules } from ':shopping-list/common-constructs';
49
+ +import { suppressRules } from '@shopping-list/common-constructs';
50
50
  ...
51
51
  +suppressRules(
52
52
  + this.shoppingListTable,
@@ -69,7 +69,7 @@ The `UserIdentity` construct can generally be swapped out without changes by adj
69
69
 
70
70
  ```diff lang="ts"
71
71
  -import { UserIdentity } from "@aws/pdk/identity";
72
- +import { UserIdentity } from ':shopping-list/common-constructs';
72
+ +import { UserIdentity } from '@shopping-list/common-constructs';
73
73
  ...
74
74
  const userIdentity = new UserIdentity(this, `${id}UserIdentity`);
75
75
  ```
@@ -93,7 +93,7 @@ Follow the below steps:
93
93
  ```diff lang="ts"
94
94
  // stacks/application-stack.ts
95
95
  -import { MyApi } from "../constructs/apis/myapi";
96
- +import { Api } from ':shopping-list/common-constructs';
96
+ +import { Api } from '@shopping-list/common-constructs';
97
97
  ...
98
98
  -const myapi = new MyApi(this, "MyApi", {
99
99
  - databaseConstruct,
@@ -139,7 +139,7 @@ Finally, we add the `Website` construct from `packages/common/constructs/src/app
139
139
 
140
140
  ```diff lang="ts"
141
141
  -import { Website } from "../constructs/websites/website";
142
- +import { Website } from ':shopping-list/common-constructs';
142
+ +import { Website } from '@shopping-list/common-constructs';
143
143
  ...
144
144
  -new Website(this, "Website", {
145
145
  - userIdentity,