@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.
- package/bin/aws-nx-mcp.js +14210 -13550
- package/docs/get_started/building-with-ai.mdx +116 -0
- package/docs/get_started/concepts.mdx +67 -0
- package/docs/get_started/existing-project.mdx +180 -0
- package/docs/get_started/graph-builder.mdx +39 -0
- package/docs/get_started/quick-start.mdx +277 -0
- package/docs/get_started/tutorials/contribute-generator.mdx +408 -0
- package/docs/get_started/tutorials/dungeon-game/1.mdx +1578 -0
- package/docs/get_started/tutorials/dungeon-game/2.mdx +245 -0
- package/docs/get_started/tutorials/dungeon-game/3.mdx +66 -0
- package/docs/get_started/tutorials/dungeon-game/4.mdx +164 -0
- package/docs/get_started/tutorials/dungeon-game/overview.mdx +145 -0
- package/docs/get_started/tutorials/dungeon-game/wrap-up.mdx +41 -0
- package/docs/get_started/upgrading.mdx +147 -0
- package/docs/guides/agentcore-gateway.mdx +490 -0
- package/docs/guides/agentcore-harness.mdx +275 -0
- package/docs/guides/astro-docs.mdx +8 -0
- package/docs/guides/connection/agentcore-gateway-agent.mdx +222 -0
- package/docs/guides/connection/agentcore-gateway-gateway.mdx +154 -0
- package/docs/guides/connection/agentcore-gateway-mcp.mdx +134 -0
- package/docs/guides/connection/py-agent-a2a.mdx +48 -16
- package/docs/guides/connection/py-agent-dynamodb.mdx +116 -0
- package/docs/guides/connection/py-agent-gateway.mdx +182 -0
- package/docs/guides/connection/py-agent-mcp.mdx +43 -14
- package/docs/guides/connection/py-agent-rdb.mdx +178 -0
- package/docs/guides/connection/py-fast-api-dynamodb.mdx +56 -0
- package/docs/guides/connection/py-fast-api-rdb.mdx +184 -0
- package/docs/guides/connection/py-mcp-server-dynamodb.mdx +116 -0
- package/docs/guides/connection/py-mcp-server-rdb.mdx +187 -0
- package/docs/guides/connection/react-agentcore-gateway.mdx +112 -0
- package/docs/guides/connection/react-agui.mdx +33 -14
- package/docs/guides/connection/react-fastapi.mdx +39 -3
- package/docs/guides/connection/react-py-agent.mdx +10 -16
- package/docs/guides/connection/react-smithy.mdx +5 -5
- package/docs/guides/connection/react-trpc.mdx +2 -2
- package/docs/guides/connection/react-ts-agent.mdx +9 -9
- package/docs/guides/connection/smithy-dynamodb.mdx +6 -6
- package/docs/guides/connection/smithy-rdb.mdx +10 -10
- package/docs/guides/connection/trpc-dynamodb.mdx +5 -5
- package/docs/guides/connection/trpc-rdb.mdx +6 -6
- package/docs/guides/connection/ts-agent-a2a.mdx +14 -11
- package/docs/guides/connection/ts-agent-dynamodb.mdx +5 -5
- package/docs/guides/connection/ts-agent-gateway.mdx +147 -0
- package/docs/guides/connection/ts-agent-mcp.mdx +12 -9
- package/docs/guides/connection/ts-agent-rdb.mdx +70 -25
- package/docs/guides/connection/ts-mcp-server-dynamodb.mdx +5 -5
- package/docs/guides/connection/ts-mcp-server-rdb.mdx +68 -18
- package/docs/guides/connection.mdx +122 -5
- package/docs/guides/docker-bundling.mdx +81 -12
- package/docs/guides/fastapi.mdx +252 -15
- package/docs/guides/local-development.mdx +87 -0
- package/docs/guides/nx-generator.mdx +4 -3
- package/docs/guides/nx-migration.mdx +165 -0
- package/docs/guides/py-agent.mdx +332 -55
- package/docs/guides/py-dynamodb.mdx +476 -0
- package/docs/guides/py-mcp-server.mdx +57 -2
- package/docs/guides/py-rdb.mdx +265 -0
- package/docs/guides/python-lambda-function.mdx +1 -1
- package/docs/guides/react-website-auth.mdx +104 -5
- package/docs/guides/react-website.mdx +413 -99
- package/docs/guides/runtime-config.mdx +1 -1
- package/docs/guides/security.mdx +75 -0
- package/docs/guides/smithy-project.mdx +167 -0
- package/docs/guides/terraform-project.mdx +2 -2
- package/docs/guides/trpc.mdx +54 -17
- package/docs/guides/ts-agent.mdx +207 -23
- package/docs/guides/ts-dcr-proxy.mdx +569 -0
- package/docs/guides/ts-dynamodb.mdx +66 -242
- package/docs/guides/ts-lambda-function.mdx +1 -1
- package/docs/guides/ts-mcp-server.mdx +111 -29
- package/docs/guides/ts-nx-plugin.mdx +4 -4
- package/docs/guides/ts-rdb.mdx +114 -468
- package/docs/guides/ts-smithy-api.mdx +259 -19
- package/docs/guides/typescript-infrastructure.mdx +46 -24
- package/docs/guides/typescript-project.mdx +134 -27
- package/docs/guides/workspace.mdx +10 -3
- package/docs/snippets/agent/architecture.mdx +1 -1
- package/docs/snippets/agent/bedrock-deployment.mdx +9 -5
- package/docs/snippets/agent/runtime-arn.mdx +23 -2
- package/docs/snippets/agent/securing-your-agent.mdx +39 -0
- package/docs/snippets/api/access-logging.mdx +38 -0
- package/docs/snippets/api/cors-configuration-cdk-note.mdx +1 -1
- package/docs/snippets/api/cors-configuration-terraform-note.mdx +1 -1
- package/docs/snippets/api/type-safe-api-integrations.mdx +69 -50
- package/docs/snippets/api/waf-configuration.mdx +3 -3
- package/docs/snippets/connection/a2a-infrastructure.mdx +1 -1
- package/docs/snippets/connection/dynamodb-local-development.mdx +2 -2
- package/docs/snippets/connection/lambda-dynamodb-access.mdx +1 -1
- package/docs/snippets/connection/py-dynamodb-local-development.mdx +7 -0
- package/docs/snippets/connection/py-lambda-rdb-ssl-requirements.mdx +7 -0
- package/docs/snippets/connection/rdb-api-infrastructure.mdx +51 -19
- package/docs/snippets/dynamodb/deploying-table.mdx +145 -0
- package/docs/snippets/dynamodb/encryption-options.mdx +168 -0
- package/docs/snippets/dynamodb/gsi-config.mdx +38 -0
- package/docs/snippets/dynamodb/infrastructure.mdx +33 -0
- package/docs/snippets/dynamodb/local-dev-start.mdx +13 -0
- package/docs/snippets/dynamodb/local-dev-windows.mdx +15 -0
- package/docs/snippets/lambda-function/deploying-your-function.mdx +3 -3
- package/docs/snippets/mcp/architecture.mdx +1 -1
- package/docs/snippets/mcp/bedrock-deployment.mdx +9 -5
- package/docs/snippets/mcp/config.mdx +3 -2
- package/docs/snippets/mcp/shared-constructs.mdx +4 -5
- package/docs/snippets/pdk-migration/example/01-migrate-api.mdx +7 -5
- package/docs/snippets/pdk-migration/example/02-migrate-website.mdx +29 -10
- package/docs/snippets/pdk-migration/example/03-migrate-infra.mdx +4 -4
- package/docs/snippets/pdk-migration/faq/type-safe-api.mdx +5 -111
- package/docs/snippets/prerequisites.mdx +1 -4
- package/docs/snippets/rdb/architecture.mdx +38 -0
- package/docs/snippets/rdb/cluster-instances.mdx +31 -0
- package/docs/snippets/rdb/deletion-protection.mdx +34 -0
- package/docs/snippets/rdb/deploying.mdx +187 -0
- package/docs/snippets/rdb/encryption-key-rotation.mdx +30 -0
- package/docs/snippets/rdb/engine-version.mdx +63 -0
- package/docs/snippets/rdb/infrastructure.mdx +35 -0
- package/docs/snippets/rdb/logging-mysql.mdx +5 -0
- package/docs/snippets/rdb/logging-postgres.mdx +5 -0
- package/docs/snippets/rdb/performance-insights.mdx +34 -0
- package/docs/snippets/rdb/rds-proxy.mdx +50 -0
- package/docs/snippets/rdb/removal-policy.mdx +57 -0
- package/docs/snippets/rdb/serverless-capacity.mdx +32 -0
- package/docs/snippets/recommended-prerequisites.mdx +10 -0
- package/docs/snippets/required-prerequisites.mdx +1 -4
- package/docs/snippets/runtime-config-app-id-note.mdx +8 -0
- package/docs/snippets/shared-constructs.mdx +1 -1
- package/docs/snippets/trivy-image-scan.mdx +37 -0
- package/generators.json +162 -10
- package/package.json +1 -1
- package/src/agentcore-gateway/agent-connection/schema.json +31 -0
- package/src/agentcore-gateway/gateway-connection/schema.json +31 -0
- package/src/agentcore-gateway/mcp-connection/schema.json +31 -0
- package/src/agentcore-gateway/react-connection/schema.json +31 -0
- package/src/agentcore-gateway/schema.json +72 -0
- package/src/agentcore-harness/schema.json +53 -0
- package/src/connection/schema.json +5 -0
- package/src/infra/app/schema.json +5 -0
- package/src/init/schema.json +35 -0
- package/src/internal/test-matrix/schema.json +21 -0
- package/src/license/schema.json +5 -0
- package/src/preset/schema.json +16 -5
- package/src/py/agent/a2a-connection/schema.json +5 -0
- package/src/py/agent/gateway-connection/schema.json +31 -0
- package/src/py/agent/mcp-connection/schema.json +5 -0
- package/src/py/agent/react-connection/schema.json +5 -0
- package/src/py/agent/schema.json +15 -1
- package/src/py/api/schema.json +5 -0
- package/src/py/dynamodb/agent-connection/schema.json +27 -0
- package/src/py/dynamodb/fast-api-connection/schema.json +23 -0
- package/src/py/dynamodb/mcp-server-connection/schema.json +27 -0
- package/src/py/dynamodb/schema.json +76 -0
- package/src/py/fast-api/react/schema.json +5 -0
- package/src/py/fast-api/schema.json +6 -0
- package/src/py/lambda-function/schema.json +6 -1
- package/src/py/mcp-server/schema.json +6 -0
- package/src/py/project/schema.json +6 -0
- package/src/py/rdb/agent-connection/schema.json +27 -0
- package/src/py/rdb/fast-api-connection/schema.json +23 -0
- package/src/py/rdb/mcp-server-connection/schema.json +27 -0
- package/src/py/rdb/schema.json +78 -0
- package/src/smithy/project/schema.json +28 -1
- package/src/smithy/react-connection/schema.json +5 -0
- package/src/smithy/ts/api/schema.json +6 -0
- package/src/terraform/project/schema.json +5 -0
- package/src/trpc/backend/schema.json +6 -0
- package/src/trpc/react/schema.json +5 -0
- package/src/ts/agent/a2a-connection/schema.json +5 -0
- package/src/ts/agent/gateway-connection/schema.json +31 -0
- package/src/ts/agent/mcp-connection/schema.json +5 -0
- package/src/ts/agent/react-connection/schema.json +5 -0
- package/src/ts/agent/schema.json +14 -0
- package/src/ts/api/schema.json +5 -0
- package/src/ts/astro-docs/schema.json +3 -3
- package/src/ts/dcr-proxy/schema.json +44 -0
- package/src/ts/docs/schema.json +3 -3
- package/src/ts/dynamodb/agent-connection/schema.json +5 -0
- package/src/ts/dynamodb/mcp-server-connection/schema.json +5 -0
- package/src/ts/dynamodb/schema.json +26 -2
- package/src/ts/dynamodb/smithy-connection/schema.json +5 -0
- package/src/ts/dynamodb/trpc-connection/schema.json +5 -0
- package/src/ts/lambda-function/schema.json +5 -0
- package/src/ts/lib/schema.json +5 -0
- package/src/ts/mcp-server/schema.json +6 -0
- package/src/ts/nx-generator/schema.json +5 -0
- package/src/ts/nx-migration/schema.json +63 -0
- package/src/ts/nx-plugin/schema.json +5 -0
- package/src/ts/rdb/agent-connection/schema.json +5 -0
- package/src/ts/rdb/mcp-server-connection/schema.json +5 -0
- package/src/ts/rdb/schema.json +7 -1
- package/src/ts/rdb/smithy-connection/schema.json +5 -0
- package/src/ts/rdb/trpc-connection/schema.json +5 -0
- package/src/ts/react-website/app/schema.json +12 -6
- package/src/ts/react-website/cognito-auth/schema.json +5 -0
- package/src/ts/react-website/runtime-config/schema.json +5 -0
- package/src/ts/website/app/schema.json +11 -6
- package/src/ts/website/auth/schema.json +5 -0
- /package/docs/snippets/connection/{lambda-rdb-ssl-requirements.mdx → ts-lambda-rdb-ssl-requirements.mdx} +0 -0
- /package/docs/snippets/connection/{mcp-server-rdb-ssl-requirements.mdx → ts-mcp-server-rdb-ssl-requirements.mdx} +0 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Encryption Options
|
|
3
|
+
---
|
|
4
|
+
import Infrastructure from '@components/infrastructure.astro';
|
|
5
|
+
import OptionFilter from '@components/option-filter.astro';
|
|
6
|
+
|
|
7
|
+
#### Use an AWS Managed Key
|
|
8
|
+
|
|
9
|
+
Uses the shared `aws/dynamodb` KMS key that AWS manages on your behalf. It's visible in your account's KMS console and billed per request, but there's no key for you to create, rotate or delete.
|
|
10
|
+
|
|
11
|
+
<Infrastructure>
|
|
12
|
+
<Fragment slot="cdk">
|
|
13
|
+
|
|
14
|
+
```ts title="packages/infra/src/stacks/application-stack.ts"
|
|
15
|
+
import { TableEncryption } from 'aws-cdk-lib/aws-dynamodb';
|
|
16
|
+
import { MyTable } from '@my-scope/common-constructs';
|
|
17
|
+
|
|
18
|
+
const table = new MyTable(this, 'Table', {
|
|
19
|
+
encryption: TableEncryption.AWS_MANAGED,
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
:::tip[Checkov]
|
|
24
|
+
Choosing `AWS_MANAGED` means the table is no longer encrypted with a customer-managed key, which fails Checkov's `CKV_AWS_119`. Suppress it on the table:
|
|
25
|
+
|
|
26
|
+
```ts title="packages/infra/src/stacks/application-stack.ts"
|
|
27
|
+
import { suppressRules } from '@my-scope/common-constructs';
|
|
28
|
+
|
|
29
|
+
suppressRules(table.table, ['CKV_AWS_119'], 'Using an AWS managed key rather than a customer-managed CMK');
|
|
30
|
+
```
|
|
31
|
+
:::
|
|
32
|
+
</Fragment>
|
|
33
|
+
<Fragment slot="terraform">
|
|
34
|
+
|
|
35
|
+
```hcl title="packages/infra/src/main.tf"
|
|
36
|
+
module "my_table" {
|
|
37
|
+
source = "../../common/terraform/src/app/dynamodb/my-table"
|
|
38
|
+
encryption = "AWS_MANAGED"
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
</Fragment>
|
|
42
|
+
</Infrastructure>
|
|
43
|
+
|
|
44
|
+
#### Use the AWS Owned Key
|
|
45
|
+
|
|
46
|
+
Uses a key fully owned and managed by AWS — free, with no key visible in your account at all. The simplest option when you don't need a customer- or account-visible key for compliance reasons.
|
|
47
|
+
|
|
48
|
+
<Infrastructure>
|
|
49
|
+
<Fragment slot="cdk">
|
|
50
|
+
|
|
51
|
+
```ts title="packages/infra/src/stacks/application-stack.ts"
|
|
52
|
+
import { TableEncryption } from 'aws-cdk-lib/aws-dynamodb';
|
|
53
|
+
import { MyTable } from '@my-scope/common-constructs';
|
|
54
|
+
|
|
55
|
+
const table = new MyTable(this, 'Table', {
|
|
56
|
+
encryption: TableEncryption.DEFAULT,
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
:::tip[Checkov]
|
|
61
|
+
Choosing `DEFAULT` means the table is no longer encrypted with a customer-managed key, which fails Checkov's `CKV_AWS_119`. Suppress it on the table:
|
|
62
|
+
|
|
63
|
+
```ts title="packages/infra/src/stacks/application-stack.ts"
|
|
64
|
+
import { suppressRules } from '@my-scope/common-constructs';
|
|
65
|
+
|
|
66
|
+
suppressRules(table.table, ['CKV_AWS_119'], 'Using the AWS owned key rather than a customer-managed CMK');
|
|
67
|
+
```
|
|
68
|
+
:::
|
|
69
|
+
</Fragment>
|
|
70
|
+
<Fragment slot="terraform">
|
|
71
|
+
|
|
72
|
+
```hcl title="packages/infra/src/main.tf"
|
|
73
|
+
module "my_table" {
|
|
74
|
+
source = "../../common/terraform/src/app/dynamodb/my-table"
|
|
75
|
+
encryption = "DEFAULT"
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
</Fragment>
|
|
79
|
+
</Infrastructure>
|
|
80
|
+
|
|
81
|
+
<OptionFilter when={{ iac: 'terraform' }} description="Switching an already-deployed table away from CUSTOMER_MANAGED">
|
|
82
|
+
#### Switching away from CUSTOMER_MANAGED
|
|
83
|
+
|
|
84
|
+
On an **already-deployed** table, changing `encryption` away from `CUSTOMER_MANAGED` (to either `AWS_MANAGED` or `DEFAULT`) in a single `terraform apply` fails: Terraform destroys the customer-managed key before updating the table, and DynamoDB then rejects the update because the key is already pending deletion.
|
|
85
|
+
|
|
86
|
+
Work around it by updating the table's encryption directly via the AWS CLI first, then letting Terraform catch up and clean up the orphaned key:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# For AWS_MANAGED:
|
|
90
|
+
aws dynamodb update-table --table-name <table-name> \
|
|
91
|
+
--sse-specification Enabled=true,SSEType=KMS,KMSMasterKeyId=alias/aws/dynamodb
|
|
92
|
+
|
|
93
|
+
# For DEFAULT:
|
|
94
|
+
aws dynamodb update-table --table-name <table-name> --sse-specification Enabled=false
|
|
95
|
+
|
|
96
|
+
# Then wait for this to report ENABLED (or for SSEDescription to disappear, for DEFAULT):
|
|
97
|
+
aws dynamodb describe-table --table-name <table-name> --query Table.SSEDescription.Status
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Then update `encryption` in your Terraform config and run `terraform apply` as normal — Terraform now only needs to destroy the already-unused key, with nothing left depending on it.
|
|
101
|
+
</OptionFilter>
|
|
102
|
+
|
|
103
|
+
#### Use Your Own KMS Key
|
|
104
|
+
|
|
105
|
+
Provide an existing customer-managed key instead of having one created for you. The key must already grant the DynamoDB service the permissions it needs in its own key policy.
|
|
106
|
+
|
|
107
|
+
<Infrastructure>
|
|
108
|
+
<Fragment slot="cdk">
|
|
109
|
+
|
|
110
|
+
```ts title="packages/infra/src/stacks/application-stack.ts"
|
|
111
|
+
import { Key } from 'aws-cdk-lib/aws-kms';
|
|
112
|
+
import { MyTable } from '@my-scope/common-constructs';
|
|
113
|
+
|
|
114
|
+
const key = Key.fromKeyArn(this, 'Key', 'arn:aws:kms:us-east-1:111111111111:key/my-key-id');
|
|
115
|
+
|
|
116
|
+
const table = new MyTable(this, 'Table', {
|
|
117
|
+
encryptionKey: key,
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
</Fragment>
|
|
121
|
+
<Fragment slot="terraform">
|
|
122
|
+
|
|
123
|
+
```hcl title="packages/infra/src/main.tf"
|
|
124
|
+
module "my_table" {
|
|
125
|
+
source = "../../common/terraform/src/app/dynamodb/my-table"
|
|
126
|
+
kms_key_arn = "arn:aws:kms:us-east-1:111111111111:key/my-key-id"
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
</Fragment>
|
|
130
|
+
</Infrastructure>
|
|
131
|
+
|
|
132
|
+
#### Encryption Key Rotation
|
|
133
|
+
|
|
134
|
+
When the table creates its own customer-managed KMS key (the default, and only when you haven't provided your own key), that key has automatic key rotation enabled by default. Disable it if your security policy manages rotation externally.
|
|
135
|
+
|
|
136
|
+
##### Disable Encryption Key Rotation
|
|
137
|
+
|
|
138
|
+
<Infrastructure>
|
|
139
|
+
<Fragment slot="cdk">
|
|
140
|
+
|
|
141
|
+
```ts title="packages/infra/src/stacks/application-stack.ts"
|
|
142
|
+
import { MyTable } from '@my-scope/common-constructs';
|
|
143
|
+
|
|
144
|
+
const table = new MyTable(this, 'Table', {
|
|
145
|
+
enableKeyRotation: false,
|
|
146
|
+
});
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
:::tip[Checkov]
|
|
150
|
+
Disabling key rotation, or bringing your own key that doesn't rotate, fails Checkov's `CKV_AWS_7`. Suppress it on the key:
|
|
151
|
+
|
|
152
|
+
```ts title="packages/infra/src/stacks/application-stack.ts"
|
|
153
|
+
import { suppressRules } from '@my-scope/common-constructs';
|
|
154
|
+
|
|
155
|
+
suppressRules(table.table.encryptionKey!, ['CKV_AWS_7'], 'Key rotation is managed externally');
|
|
156
|
+
```
|
|
157
|
+
:::
|
|
158
|
+
</Fragment>
|
|
159
|
+
<Fragment slot="terraform">
|
|
160
|
+
|
|
161
|
+
```hcl title="packages/infra/src/main.tf"
|
|
162
|
+
module "my_table" {
|
|
163
|
+
source = "../../common/terraform/src/app/dynamodb/my-table"
|
|
164
|
+
enable_key_rotation = false
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
</Fragment>
|
|
168
|
+
</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 `
|
|
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 '
|
|
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 '
|
|
41
|
+
import { MyProjectMyFunction } from '@my-scope/common-constructs';
|
|
42
42
|
|
|
43
43
|
export class ExampleStack extends Stack {
|
|
44
44
|
constructor(scope: Construct, id: string) {
|
|
@@ -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 '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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 {
|
|
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
|
:::
|
|
@@ -12,9 +12,8 @@ For deploying your MCP Server, the following files are generated:
|
|
|
12
12
|
- packages/common/constructs/src
|
|
13
13
|
- app
|
|
14
14
|
- mcp-servers
|
|
15
|
-
- \<
|
|
16
|
-
- \<
|
|
17
|
-
- Dockerfile Passthrough docker file used by the CDK construct
|
|
15
|
+
- \<mcp-server-name>
|
|
16
|
+
- \<mcp-server-name>.ts CDK construct for deploying your MCP Server
|
|
18
17
|
</FileTree>
|
|
19
18
|
</Fragment>
|
|
20
19
|
<Fragment slot="terraform">
|
|
@@ -22,8 +21,8 @@ For deploying your MCP Server, the following files are generated:
|
|
|
22
21
|
- packages/common/terraform/src
|
|
23
22
|
- app
|
|
24
23
|
- mcp-servers
|
|
25
|
-
- \<
|
|
26
|
-
- \<
|
|
24
|
+
- \<mcp-server-name>
|
|
25
|
+
- \<mcp-server-name>.tf Module for deploying your MCP Server
|
|
27
26
|
- core
|
|
28
27
|
- agent-core
|
|
29
28
|
- runtime.tf Generic module for deploying to Bedrock AgentCore Runtime
|
|
@@ -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#
|
|
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#
|
|
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
|
|
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": "
|
|
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#
|
|
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#
|
|
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#
|
|
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#
|
|
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#
|
|
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
|
|
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.
|
|
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={["
|
|
103
|
+
<NxCommands commands={["dev website"]} />
|
|
85
104
|
|
|
86
105
|
:::tip
|
|
87
|
-
We're using the `
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
142
|
+
+import { Website } from '@shopping-list/common-constructs';
|
|
143
143
|
...
|
|
144
144
|
-new Website(this, "Website", {
|
|
145
145
|
- userIdentity,
|