@aws/nx-plugin-mcp 1.0.0-rc.43 → 1.0.0-rc.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/bin/aws-nx-mcp.js +86 -79
  2. package/docs/get_started/tutorials/dungeon-game/1.mdx +4 -4
  3. package/docs/get_started/tutorials/dungeon-game/3.mdx +1 -1
  4. package/docs/guides/agentcore-gateway.mdx +94 -7
  5. package/docs/guides/connection/py-agent-a2a.mdx +1 -1
  6. package/docs/guides/connection/py-agent-gateway.mdx +3 -1
  7. package/docs/guides/connection/react-agui.mdx +9 -9
  8. package/docs/guides/connection/react-py-agent.mdx +2 -2
  9. package/docs/guides/connection/ts-agent-a2a.mdx +1 -1
  10. package/docs/guides/connection/ts-agent-gateway.mdx +3 -1
  11. package/docs/guides/docker-bundling.mdx +10 -13
  12. package/docs/guides/fastapi.mdx +2 -2
  13. package/docs/guides/py-dynamodb.mdx +3 -3
  14. package/docs/guides/py-rdb.mdx +3 -1
  15. package/docs/guides/python-lambda-function.mdx +1 -1
  16. package/docs/guides/react-website-auth.mdx +1 -1
  17. package/docs/guides/react-website.mdx +3 -3
  18. package/docs/guides/security.mdx +1 -1
  19. package/docs/guides/trpc.mdx +2 -2
  20. package/docs/guides/ts-dcr-proxy.mdx +569 -0
  21. package/docs/guides/ts-dynamodb.mdx +3 -3
  22. package/docs/guides/ts-lambda-function.mdx +1 -1
  23. package/docs/guides/ts-rdb.mdx +4 -0
  24. package/docs/guides/ts-smithy-api.mdx +3 -3
  25. package/docs/guides/typescript-infrastructure.mdx +6 -6
  26. package/docs/snippets/lambda-function/deploying-your-function.mdx +1 -1
  27. package/docs/snippets/rdb/deploying.mdx +1 -1
  28. package/docs/snippets/runtime-config-app-id-note.mdx +8 -0
  29. package/docs/snippets/shared-constructs.mdx +1 -1
  30. package/docs/snippets/trivy-image-scan.mdx +13 -3
  31. package/generators.json +6 -0
  32. package/package.json +1 -1
  33. package/src/agentcore-gateway/schema.json +3 -2
  34. package/src/ts/dcr-proxy/schema.json +44 -0
@@ -15,7 +15,7 @@ import Link from '@components/link.astro';
15
15
  import NxCommands from '@components/nx-commands.astro';
16
16
  import OptionFilter from '@components/option-filter.astro';
17
17
 
18
- Generate an [Amazon Bedrock AgentCore Gateway](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway.html) project. An AgentCore Gateway is a managed entry point that aggregates one or more MCP server targets behind a single MCP endpoint, evaluates every tool call against a [Cedar policy engine](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/policy.html), and signs outbound traffic to MCP servers with IAM SigV4.
18
+ Generate an [Amazon Bedrock AgentCore Gateway](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway.html) project. An AgentCore Gateway is a managed entry point that aggregates one or more MCP server targets behind a single MCP endpoint, authenticates inbound requests (IAM or Cognito), evaluates every tool call against a [Cedar policy engine](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/policy.html), and signs outbound traffic to MCP servers with IAM SigV4.
19
19
 
20
20
  ## Usage
21
21
 
@@ -34,7 +34,7 @@ The generator creates a new project at `packages/<name>/`, plus a CDK construct
34
34
  <FileTree>
35
35
  - packages/\<name>/
36
36
  - policies/ Cedar policy source files (omitted when `cedarPolicy: false`)
37
- - permit-all.cedar Default Cedar policy that permits authenticated callers from within the same AWS account
37
+ - permit-all.cedar Default Cedar policy that permits authenticated callers
38
38
  - README.md Reference for writing Cedar policies
39
39
  - local-dev.ts Local gateway aggregating attached MCP servers for local development
40
40
  - project.json Adds the `serve` and `dev` targets
@@ -71,7 +71,7 @@ Infrastructure is generated when `infra` is `agentcore` (the default). With `inf
71
71
 
72
72
  The generated construct creates the following AWS resources:
73
73
 
74
- - An `AgentCore::Gateway` configured for the MCP protocol with `GatewayAuthorizer.usingAwsIam()` (inbound IAM authentication)
74
+ - An `AgentCore::Gateway` configured for the MCP protocol with inbound IAM authentication (default) or Cognito JWT authentication (see <a href="#authentication">Authentication</a>)
75
75
  - An `AgentCore::PolicyEngine` running in `ENFORCE` mode, attached to the Gateway (omitted when `cedarPolicy: false`)
76
76
  - One `AgentCore::Policy` per `.cedar` file in `policies/`
77
77
  - An AWS WAFv2 Web ACL associated with the Gateway, with request logging to CloudWatch (enabled by default — see <a href="#aws-waf">AWS WAF</a>)
@@ -95,7 +95,7 @@ waf: WAF {
95
95
  icon: /nx-plugin-for-aws/icons/aws/waf.svg
96
96
  }
97
97
 
98
- gateway: AgentCore Gateway\n(MCP, IAM auth) {
98
+ gateway: AgentCore Gateway\n(MCP, IAM or Cognito auth) {
99
99
  shape: image
100
100
  icon: /nx-plugin-for-aws/icons/aws/bedrock-agentcore-gateway.svg
101
101
  }
@@ -109,6 +109,61 @@ waf -> gateway
109
109
  gateway -> targets
110
110
  ```
111
111
 
112
+ ## Authentication
113
+
114
+ The `auth` option configures how the Gateway authenticates inbound requests. Choose between `iam` (default) and `cognito`.
115
+
116
+ ### IAM
117
+
118
+ By default, the Gateway is configured with `GatewayAuthorizer.usingAwsIam()`. Callers sign requests with SigV4, and the caller's IAM identity is available to Cedar policies as an `AgentCore::IamEntity` principal. This is the recommended option when your callers are agents or services running in AWS — for example an <Link path="/guides/ts-agent">agent</Link> connected via the <Link path="guides/connection/ts-agent-gateway">agent to Gateway connection generator</Link>, which signs its calls with its own execution role.
119
+
120
+ ### Cognito
121
+
122
+ When you select `cognito`, the Gateway is configured with a Custom JWT authorizer pointing at a Cognito user pool. Callers authenticate by presenting a JWT bearer token, and the token's `sub` claim is available to Cedar policies as an `AgentCore::OAuthUser` principal. Use this when your callers authenticate through Cognito — for example a website or a coding agent connecting via the <Link path="guides/ts-dcr-proxy">`ts#dcr-proxy` generator</Link>.
123
+
124
+ The generated infrastructure consumes an existing Cognito user pool and client — it does not create them. You can generate a `UserIdentity` using the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link>, or provide your own.
125
+
126
+ <Infrastructure>
127
+ <Fragment slot="cdk">
128
+ The generated construct requires an `identity` prop supplying the user pool and client:
129
+
130
+ ```ts {7,9-11} title="packages/infra/src/stacks/application-stack.ts"
131
+ import { MyGateway, UserIdentity } from ':my-scope/common-constructs';
132
+
133
+ export class ApplicationStack extends Stack {
134
+ constructor(scope: Construct, id: string, props?: StackProps) {
135
+ super(scope, id, props);
136
+
137
+ const identity = new UserIdentity(this, 'Identity');
138
+
139
+ new MyGateway(this, 'MyGateway', {
140
+ identity,
141
+ });
142
+ }
143
+ }
144
+ ```
145
+ </Fragment>
146
+ <Fragment slot="terraform">
147
+ The generated module requires `user_pool_id` and `user_pool_client_ids` variables:
148
+
149
+ ```hcl {6-7} title="packages/infra/src/main.tf"
150
+ module "user_identity" {
151
+ source = "../../common/terraform/src/core/user-identity"
152
+ }
153
+
154
+ module "my_gateway" {
155
+ source = "../../common/terraform/src/app/gateways/my-gateway"
156
+ user_pool_id = module.user_identity.user_pool_id
157
+ user_pool_client_ids = [module.user_identity.user_pool_client_id]
158
+ }
159
+ ```
160
+ </Fragment>
161
+ </Infrastructure>
162
+
163
+ :::note[Custom OIDC providers]
164
+ To authenticate with a non-Cognito OIDC provider, modify the generated Gateway construct or Terraform module directly — swap the authorizer's discovery URL and allowed clients for your provider's. Agent to Gateway connection generators only support `IAM`-authenticated gateways, since agents sign their calls with SigV4.
165
+ :::
166
+
112
167
  ## Writing Policies
113
168
 
114
169
  <OptionFilter when={{ cedarPolicy: true }} description="Cedar policies — cedarPolicy: true only">
@@ -190,7 +245,9 @@ Additionally, the Gateway filters the response of `tools/list` so that callers o
190
245
 
191
246
  ### Default `permit-all.cedar`
192
247
 
193
- The generator ships a default policy that permits any IAM caller from the AWS account the Gateway is deployed into:
248
+ The generator ships a default policy scoped to the Gateway's authentication type.
249
+
250
+ For an **IAM** Gateway, it permits any IAM caller from the AWS account the Gateway is deployed into:
194
251
 
195
252
  ```cedar title="packages/<name>/policies/permit-all.cedar"
196
253
  permit (
@@ -202,11 +259,23 @@ permit (
202
259
  };
203
260
  ```
204
261
 
262
+ For a **Cognito** Gateway, it permits any authenticated OAuth user (the JWT authorizer has already validated the token's user pool and client before policies are evaluated):
263
+
264
+ ```cedar title="packages/<name>/policies/permit-all.cedar"
265
+ permit (
266
+ principal is AgentCore::OAuthUser,
267
+ action,
268
+ resource == AgentCore::Gateway::"<%= gatewayArn %>"
269
+ );
270
+ ```
271
+
205
272
  To lock things down further, add narrower policies alongside it. Always retain at least one matching `permit` in the policy set, otherwise default-deny will block every call.
206
273
 
207
274
  ### Policy scope reference
208
275
 
209
- For Gateways generated by this plugin, all callers are IAM principals (the Gateway is configured with `GatewayAuthorizer.usingAwsIam()`):
276
+ The principal type depends on how the Gateway authenticates callers (see <a href="#authentication">Authentication</a>).
277
+
278
+ For an **IAM** Gateway, callers are IAM principals:
210
279
 
211
280
  ```
212
281
  principal is AgentCore::IamEntity
@@ -220,6 +289,24 @@ principal == AgentCore::IamEntity::"arn:aws:sts::<%= accountId %>:assumed-role/<
220
289
 
221
290
  The same value is available as `principal.id` for `when` clauses. Reserve `like` for genuine patterns, such as the account-wide match in the default `permit-all.cedar`.
222
291
 
292
+ For a **Cognito** Gateway, callers are OAuth users built from the JWT token's `sub` claim, and JWT claims (username, scope, etc.) are available as principal tags:
293
+
294
+ ```
295
+ principal is AgentCore::OAuthUser
296
+ ```
297
+
298
+ Match individual claims in `when` clauses — for example to require a scope:
299
+
300
+ ```cedar
301
+ permit (
302
+ principal is AgentCore::OAuthUser,
303
+ action,
304
+ resource == AgentCore::Gateway::"<%= gatewayArn %>"
305
+ ) when {
306
+ principal.scope == "gateway/invoke"
307
+ };
308
+ ```
309
+
223
310
  Tool invocations reach the policy engine as actions with the form:
224
311
 
225
312
  ```
@@ -268,7 +355,7 @@ See the connection guide for the full local development story.
268
355
 
269
356
  ## Deploying your AgentCore Gateway
270
357
 
271
- The AgentCore Gateway generator creates CDK or Terraform infrastructure as code based on your selected `iacProvider`. You can use this to deploy your Gateway.
358
+ The AgentCore Gateway generator creates CDK or Terraform infrastructure as code based on your selected `iac`. You can use this to deploy your Gateway.
272
359
 
273
360
  <Infrastructure>
274
361
  <Fragment slot="cdk">
@@ -23,7 +23,7 @@ The generator sets up all the necessary wiring so your agent can discover and in
23
23
  Before using this generator, ensure you have:
24
24
 
25
25
  1. A Python project with a <Link path="guides/py-agent">Python Agent</Link> component (Strands or LangChain)
26
- 2. A project with an Agent component generated with `--protocol=A2A` and `--auth=IAM` (either <Link path="guides/ts-agent">`ts#agent`</Link> or <Link path="guides/py-agent">`py#agent`</Link>)
26
+ 2. A project with an Agent component generated with `--protocol=a2a` and `--auth=iam` (either <Link path="guides/ts-agent">`ts#agent`</Link> or <Link path="guides/py-agent">`py#agent`</Link>)
27
27
  3. Both components created with `infra: agentcore`
28
28
 
29
29
  ## Usage
@@ -21,7 +21,9 @@ The generator wires the agent so it authenticates to the Gateway with IAM SigV4
21
21
  Before using this generator, ensure you have:
22
22
 
23
23
  1. A Python project with a <Link path="guides/py-agent">Agent</Link> component (`infra: agentcore`)
24
- 2. A <Link path="guides/agentcore-gateway">`agentcore-gateway`</Link> project
24
+ 2. A <Link path="guides/agentcore-gateway">`agentcore-gateway`</Link> project with `auth: iam`
25
+
26
+ The Gateway must use IAM authentication — the agent signs its requests with SigV4 using its own execution role. The generator rejects Cognito-authenticated gateways.
25
27
 
26
28
  ## Usage
27
29
 
@@ -22,7 +22,7 @@ Nx Plugin for AWS provides a generator to connect a React website to an Agent th
22
22
  Before using this generator, ensure you have:
23
23
 
24
24
  1. A React website (generated using the <Link path="guides/react-website">`ts#website` generator</Link>)
25
- 2. A TypeScript or Python Agent with `protocol=AG-UI` (generated using the <Link path="guides/ts-agent">`ts#agent`</Link> or <Link path="guides/py-agent">`py#agent`</Link> generator)
25
+ 2. A TypeScript or Python Agent with `protocol=ag-ui` (generated using the <Link path="guides/ts-agent">`ts#agent`</Link> or <Link path="guides/py-agent">`py#agent`</Link> generator)
26
26
  3. For deployed agents, Cognito Auth added via the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link>
27
27
 
28
28
  ## Usage
@@ -47,8 +47,8 @@ The generator creates a **single shared** `AguiProvider` component, one hook per
47
47
  - components
48
48
  - AguiProvider.tsx Single `CopilotKitProvider` for every AG-UI agent. Created on the first `connection` run and updated on subsequent runs to register each new agent.
49
49
  - copilot
50
- - index.tsx Re-exports `CopilotChat`, `CopilotSidebar` and `CopilotPopup` with slot defaults that match your website's `uxProvider` (Cloudscape, Shadcn, or no theme at all).
51
- - *ThemeComponents*.tsx Per-slot theme components (e.g. `CloudscapeAssistantMessage.tsx`, `ShadcnChatInput.tsx`). Only vended when `uxProvider` is `Cloudscape` or `Shadcn`.
50
+ - index.tsx Re-exports `CopilotChat`, `CopilotSidebar` and `CopilotPopup` with slot defaults that match your website's `ux` (Cloudscape, Shadcn, or no theme at all).
51
+ - *ThemeComponents*.tsx Per-slot theme components (e.g. `CloudscapeAssistantMessage.tsx`, `ShadcnChatInput.tsx`). Only vended when `ux` is `cloudscape` or `shadcn`.
52
52
  - hooks
53
53
  - useAgui\<AgentName>.tsx Registers one AG-UI agent. One file per `connection` run.
54
54
  - useSigV4.tsx SigV4 signing (IAM only)
@@ -102,7 +102,7 @@ The generated code handles authentication depending on your agent's configuratio
102
102
 
103
103
  Instantiate CopilotKit components with `agentId` to select which agent to use. The id is the agent's name — the same one you chose when you ran the <Link path="guides/ts-agent">`ts#agent`</Link> or <Link path="guides/py-agent">`py#agent`</Link> generator — and you can also find it in the generated hook file (e.g. the key returned from `packages/web/src/hooks/useAgui<AgentName>.tsx`).
104
104
 
105
- Import the chat components from the generated `./components/copilot` module so the theme that matches your website's `uxProvider` is applied automatically:
105
+ Import the chat components from the generated `./components/copilot` module so the theme that matches your website's `ux` is applied automatically:
106
106
 
107
107
  ```tsx
108
108
  import { CopilotChat } from './components/copilot';
@@ -137,13 +137,13 @@ import { CopilotChat } from './components/copilot';
137
137
 
138
138
  ### Built-in Themes
139
139
 
140
- The generator reads `metadata.uxProvider` from your React website project and vends a themed wrapper module at `src/components/copilot/index.tsx` so the chat components match the rest of your UI without any extra configuration:
140
+ The generator reads `metadata.ux` from your React website project and vends a themed wrapper module at `src/components/copilot/index.tsx` so the chat components match the rest of your UI without any extra configuration:
141
141
 
142
- | `uxProvider` | Styling applied to `CopilotChat` / `CopilotSidebar` / `CopilotPopup` |
142
+ | `ux` | Styling applied to `CopilotChat` / `CopilotSidebar` / `CopilotPopup` |
143
143
  | ------------ | -------------------------------------------------------------------- |
144
- | `Cloudscape` | Messages render inside Cloudscape `ChatBubble`s with gen-AI `Avatar`s (matching the [Cloudscape generative AI chat pattern](https://cloudscape.design/patterns/genai/generative-AI-chat/)); the typing indicator becomes a `LoadingBar` and the input is a `PromptInput`. Built from `@cloudscape-design/components` and `@cloudscape-design/chat-components`. |
145
- | `Shadcn` | Assistant messages render in a `bg-muted` bubble with a `Sparkles` avatar; user messages render right-aligned in a `bg-primary` bubble with a `User` avatar. The input is a rounded `Textarea` + pill-shaped send/stop `Button` (Enter submits, Shift+Enter newlines). Uses shadcn primitives from the shared `common-shadcn` package. |
146
- | `None` (or anything else) | No theme — the module just re-exports the default CopilotKit components. |
144
+ | `cloudscape` | Messages render inside Cloudscape `ChatBubble`s with gen-AI `Avatar`s (matching the [Cloudscape generative AI chat pattern](https://cloudscape.design/patterns/genai/generative-AI-chat/)); the typing indicator becomes a `LoadingBar` and the input is a `PromptInput`. Built from `@cloudscape-design/components` and `@cloudscape-design/chat-components`. |
145
+ | `shadcn` | Assistant messages render in a `bg-muted` bubble with a `Sparkles` avatar; user messages render right-aligned in a `bg-primary` bubble with a `User` avatar. The input is a rounded `Textarea` + pill-shaped send/stop `Button` (Enter submits, Shift+Enter newlines). Uses shadcn primitives from the shared `common-shadcn` package. |
146
+ | `none` (or anything else) | No theme — the module just re-exports the default CopilotKit components. |
147
147
 
148
148
  Import the themed components from the **local theme module** (not `@copilotkit/react-core/v2` directly) so the theme is applied automatically:
149
149
 
@@ -16,7 +16,7 @@ import Snippet from '@components/snippet.astro';
16
16
  Nx Plugin for AWS provides a generator to quickly integrate your <Link path="guides/py-agent">Python Agent</Link> with a React website. It sets up all necessary configuration for connecting to your agent via a type-safe OpenAPI-generated client, including AWS IAM and Cognito authentication support.
17
17
 
18
18
  :::tip[AG-UI agents]
19
- If your Python Agent was generated with `protocol=AG-UI`, the connection generator instead wires up [CopilotKit](https://docs.copilotkit.ai/aws-strands) and an [`@ag-ui/client`](https://docs.ag-ui.com/) `HttpAgent` on the React website. See the <Link path="guides/connection/react-agui">React to AG-UI Agent</Link> guide for details.
19
+ If your Python Agent was generated with `protocol=ag-ui`, the connection generator instead wires up [CopilotKit](https://docs.copilotkit.ai/aws-strands) and an [`@ag-ui/client`](https://docs.ag-ui.com/) `HttpAgent` on the React website. See the <Link path="guides/connection/react-agui">React to AG-UI Agent</Link> guide for details.
20
20
  :::
21
21
 
22
22
  ## Prerequisites
@@ -24,7 +24,7 @@ If your Python Agent was generated with `protocol=AG-UI`, the connection generat
24
24
  Before using this generator, ensure you have:
25
25
 
26
26
  1. A React website (generated using the <Link path="guides/react-website">`ts#website` generator</Link>)
27
- 2. A Python Agent with `protocol=HTTP` (generated using the <Link path="guides/py-agent">`py#agent` generator</Link>)
27
+ 2. A Python Agent with `protocol=http` (generated using the <Link path="guides/py-agent">`py#agent` generator</Link>)
28
28
  3. Cognito Auth added via the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link>
29
29
 
30
30
  ## Usage
@@ -23,7 +23,7 @@ The generator sets up all the necessary wiring so your agent can discover and in
23
23
  Before using this generator, ensure you have:
24
24
 
25
25
  1. A TypeScript project with a <Link path="guides/ts-agent">Strands Agent</Link> component (any protocol)
26
- 2. A project with an Agent component generated with `--protocol=A2A` and `--auth=IAM` (either <Link path="guides/ts-agent">`ts#agent`</Link> or <Link path="guides/py-agent">`py#agent`</Link>)
26
+ 2. A project with an Agent component generated with `--protocol=a2a` and `--auth=iam` (either <Link path="guides/ts-agent">`ts#agent`</Link> or <Link path="guides/py-agent">`py#agent`</Link>)
27
27
  3. Both components created with `infra: agentcore`
28
28
 
29
29
  ## Usage
@@ -21,7 +21,9 @@ The generator wires the agent so it authenticates to the Gateway with IAM SigV4
21
21
  Before using this generator, ensure you have:
22
22
 
23
23
  1. A TypeScript project with a <Link path="guides/ts-agent">Agent</Link> component (`infra: agentcore`)
24
- 2. A <Link path="guides/agentcore-gateway">`agentcore-gateway`</Link> project
24
+ 2. A <Link path="guides/agentcore-gateway">`agentcore-gateway`</Link> project with `auth: iam`
25
+
26
+ The Gateway must use IAM authentication — the agent signs its requests with SigV4 using its own execution role. The generator rejects Cognito-authenticated gateways.
25
27
 
26
28
  ## Usage
27
29
 
@@ -5,6 +5,7 @@ description: Build and deploy Docker images for TypeScript and Python projects i
5
5
 
6
6
  import { FileTree, Tabs, TabItem, Code } from '@astrojs/starlight/components';
7
7
  import NxCommands from '@components/nx-commands.astro';
8
+ import PackageManagerShortCommand from '@components/package-manager-short-command.astro';
8
9
  import Link from '@components/link.astro';
9
10
  import Infrastructure from '@components/infrastructure.astro';
10
11
  import TrivyVersion from '@components/trivy-version.astro';
@@ -35,7 +36,7 @@ export const trivyTarget = `{
35
36
  Several generators (such as <Link path="/guides/ts-agent">`ts#agent`</Link> and <Link path="/guides/py-agent">`py#agent`</Link>) produce a Docker image that is pushed to Amazon ECR and consumed by AWS infrastructure. This guide describes the pattern they follow so that you can apply it to other use cases — for example, running a <Link path="/guides/fastapi">FastAPI</Link> project on Amazon ECS, or deploying a containerised Express server.
36
37
 
37
38
  :::tip[Docker or Finch]
38
- The container engine used to build images is chosen at workspace creation time via the `--containerEngine` flag (`docker`, `finch`, or `infer` — the default — which auto-detects what's installed). [Finch](https://runfinch.com/) is an open-source, drop-in alternative to Docker. The selection is recorded in `aws-nx-plugin.config.mts` and applied to every generator that emits container build commands. CDK image asset builds honour the choice via the `CDK_DOCKER` environment variable.
39
+ The container engine used to build images is chosen at workspace creation time via the `--containers` flag (`docker`, `finch`, or `infer` — the default — which auto-detects what's installed). [Finch](https://runfinch.com/) is an open-source, drop-in alternative to Docker. The selection is recorded in `aws-nx-plugin.config.mts` and applied to every generator that emits container build commands. CDK image asset builds honour the choice via the `CDK_DOCKER` environment variable.
39
40
  :::
40
41
 
41
42
  ## The Pattern
@@ -279,25 +280,21 @@ This clears the output directory, then copies both the bundle contents and the `
279
280
 
280
281
  ## Scanning Images with Trivy
281
282
 
282
- It's good practice to scan your images for known vulnerabilities. The generators that follow this pattern add a `trivy` target which scans the built image with [Trivy](https://trivy.dev/), running from the [ECR-hosted Trivy image](https://gallery.ecr.aws/aquasecurity/trivy), and fails the build on `HIGH` or `CRITICAL` findings.
283
+ It's good practice to scan your images for known vulnerabilities. The generators that follow this pattern add a `trivy` target which scans the built image with [Trivy](https://trivy.dev/), running from the [ECR-hosted Trivy image](https://gallery.ecr.aws/aquasecurity/trivy), and exits non-zero on `HIGH` or `CRITICAL` findings.
283
284
 
284
285
  Add a `trivy` target which `dependsOn` your `docker` target. It saves the built image to a tarball and scans it via a workspace-relative bind mount, so the same command works under both `docker` and `finch`:
285
286
 
286
287
  <Code lang="json" code={trivyTarget} />
287
288
 
288
- Then make `build` depend on `trivy` so the scan runs as part of a build:
289
+ Each project's per-image scan targets are aggregated under a workspace-wide `trivy` target, which the vended `trivy` root script runs (`nx run-many --target trivy`).
289
290
 
290
- ```json
291
- {
292
- "targets": {
293
- "build": {
294
- "dependsOn": ["trivy"]
295
- }
296
- }
297
- }
298
- ```
291
+ <PackageManagerShortCommand commands={['trivy']} />
299
292
 
300
- <NxCommands commands={['trivy my-project']} />
293
+ :::tip[Run Trivy in CI]
294
+ The scan is intentionally not wired into `build` since this can introduce unnecessary friction when iterating during development, as Trivy's vulnerabilty database is continually updated with new CVEs.
295
+
296
+ Instead we recommend running the above command as a dedicated step in your CI pipeline prior to deployment to production stages.
297
+ :::
301
298
 
302
299
  :::tip[Caching skips unchanged images]
303
300
  Because the image is fully determined by your project source, declaring `inputs` (here `default` and `^production`, matching the `bundle` target) lets Nx cache the scan and skip re-scanning an image that hasn't changed. Pin the Trivy image version (e.g. <code>trivy:<TrivyVersion /></code>) so scans are reproducible.
@@ -438,7 +438,7 @@ To consume a stream of responses, you can make use of the <Link path="guides/con
438
438
 
439
439
  ## Deploying your FastAPI
440
440
 
441
- The FastAPI generator creates CDK or Terraform infrastructure as code based on your selected `iacProvider`. You can use this to deploy your FastAPI.
441
+ The FastAPI generator creates CDK or Terraform infrastructure as code based on your selected `iac`. You can use this to deploy your FastAPI.
442
442
 
443
443
  <Infrastructure>
444
444
  <Fragment slot="cdk">
@@ -655,7 +655,7 @@ If you are actively working on both your CDK infrastructure and FastAPI together
655
655
  </Fragment>
656
656
  <Fragment slot="terraform">
657
657
  :::note[Terraform Limitations]
658
- We do not support type-safe integrations for Terraform, and therefore no code generation targets are configured if you selected Terraform for your `iacProvider`.
658
+ We do not support type-safe integrations for Terraform, and therefore no code generation targets are configured if you selected Terraform for your `iac`.
659
659
  :::
660
660
  </Fragment>
661
661
  </Infrastructure>
@@ -434,9 +434,9 @@ from my_db_package.entities import ExampleModel
434
434
  item = ExampleModel.get_by_id('123')
435
435
  ```
436
436
 
437
- :::note[Runtime config]
438
- When running in AWS, `get_table_name()` fetches the table name from AWS AppConfig using the `RUNTIME_CONFIG_APP_ID` environment variable. Projects built with this plugin already have this variable configured automatically. For other Python projects, ensure `RUNTIME_CONFIG_APP_ID` is set in the runtime environment with the AppConfig application ID provisioned by your infrastructure. For more information, see the <Link path="guides/runtime-config">Runtime Configuration guide</Link>.
439
- :::
437
+ Behind the scenes, `ExampleModel` calls `get_table_name()` to fetch the table name from AWS AppConfig at runtime.
438
+
439
+ <Snippet name="runtime-config-app-id-note" parentHeading="Connecting to the Table" />
440
440
 
441
441
  ## Deploying your Table
442
442
 
@@ -146,10 +146,12 @@ async def example():
146
146
  ```
147
147
 
148
148
  The database client automatically:
149
- - Retrieves database configuration from AWS AppConfig using `RUNTIME_CONFIG_APP_ID` environment variable
149
+ - Retrieves database configuration from AWS AppConfig at runtime
150
150
  - Generates temporary authentication tokens via `boto3` RDS Signer for IAM authentication
151
151
  - Establishes TLS connections using `ssl.create_default_context()`
152
152
 
153
+ <Snippet name="runtime-config-app-id-note" parentHeading="Connecting to the Database" />
154
+
153
155
  ## Deploying your Database
154
156
 
155
157
  <Snippet name="rdb/deploying" parentHeading="Deploying your Database" />
@@ -54,7 +54,7 @@ If the `functionPath` option is provided, the generater will add the necessary f
54
54
 
55
55
  <Snippet name="shared-constructs" />
56
56
 
57
- The generator creates infrastructure as code for deploying your function based on your selected `iacProvider`:
57
+ The generator creates infrastructure as code for deploying your function based on your selected `iac`:
58
58
 
59
59
  <Infrastructure>
60
60
  <Fragment slot="cdk">
@@ -43,7 +43,7 @@ You will find the following changes in your React website:
43
43
 
44
44
  <Snippet name="shared-constructs" />
45
45
 
46
- You will also find the following infrastructure code generated based on your selected `iacProvider`:
46
+ You will also find the following infrastructure code generated based on your selected `iac`:
47
47
 
48
48
  <Infrastructure>
49
49
  <Fragment slot="cdk">
@@ -23,7 +23,7 @@ This generator creates a new [React](https://react.dev/) website with [shadcn/ui
23
23
  The generated application uses [Vite](https://vite.dev/) as the build tool and bundler. It uses [TanStack Router](https://tanstack.com/router/v1) for type-safe routing.
24
24
 
25
25
  :::note[UX Provider]
26
- The default `uxProvider` is [shadcn/ui](https://ui.shadcn.com/). You can also select [Cloudscape](http://cloudscape.design/) or `None` (bring your own component library).
26
+ The default `ux` is [shadcn/ui](https://ui.shadcn.com/). You can also select [Cloudscape](http://cloudscape.design/) or `none` (bring your own component library).
27
27
  :::
28
28
 
29
29
  ## Usage
@@ -69,7 +69,7 @@ If you opted not to use [TanStack Router](https://tanstack.com/router/v1), you w
69
69
 
70
70
  <Snippet name="shared-constructs" />
71
71
 
72
- The generator creates infrastructure as code for deploying your website based on your selected `iacProvider`:
72
+ The generator creates infrastructure as code for deploying your website based on your selected `iac`:
73
73
 
74
74
  <Infrastructure>
75
75
  <Fragment slot="cdk">
@@ -416,7 +416,7 @@ You can run your tests using the `test` target:
416
416
 
417
417
  ## Deploying Your Website
418
418
 
419
- The React website generator creates CDK or Terraform infrastructure as code based on your selected `iacProvider`. You can use this to deploy your website.
419
+ The React website generator creates CDK or Terraform infrastructure as code based on your selected `iac`. You can use this to deploy your website.
420
420
 
421
421
  <Infrastructure>
422
422
  <Fragment slot="cdk">
@@ -24,7 +24,7 @@ Where vended infrastructure suppresses a Checkov rule, the suppression is scoped
24
24
 
25
25
  ### Container Image Scanning
26
26
 
27
- Projects which build container images (for example agents, MCP servers, and database migration images) include a `trivy` target which scans images for HIGH and CRITICAL vulnerabilities before they are deployed, failing the build on findings. See <Link path="/guides/docker-bundling">Docker Bundling</Link> for details, including how to suppress findings with a `.trivyignore` file.
27
+ Projects which build container images (for example agents, MCP servers, and database migration images) include a `trivy` target which scans images for HIGH and CRITICAL vulnerabilities, exiting non-zero on findings. See <Link path="/guides/docker-bundling">Docker Bundling</Link> for details, including how to suppress findings with a `.trivyignore` file.
28
28
 
29
29
  ### Credential Scanning
30
30
 
@@ -550,7 +550,7 @@ You don't need `aws-jwt-verify` or any other JWT-verification library here — t
550
550
 
551
551
  ## Deploying your tRPC API
552
552
 
553
- The tRPC API generator creates CDK or Terraform infrastructure as code based on your selected `iacProvider`. You can use this to deploy your tRPC API.
553
+ The tRPC API generator creates CDK or Terraform infrastructure as code based on your selected `iac`. You can use this to deploy your tRPC API.
554
554
 
555
555
  <Infrastructure>
556
556
  <Fragment slot="cdk">
@@ -739,7 +739,7 @@ When using `Custom` auth, your API is protected by a Lambda Authorizer that **de
739
739
  <Snippet name="api/type-safe-api-integrations" parentHeading="Integrations" />
740
740
 
741
741
  :::tip[CDK Type-Safe Integrations]
742
- If you selected CDK for your `iacProvider`, when you add or remove a procedure in your tRPC API, these changes will be reflected immediately in the CDK construct without the need to rebuild.
742
+ If you selected CDK for your `iac`, when you add or remove a procedure in your tRPC API, these changes will be reflected immediately in the CDK construct without the need to rebuild.
743
743
  :::
744
744
 
745
745
  <OptionFilter when={{ auth: 'iam' }} description="Granting API invoke access — IAM-authenticated APIs only">