@aws/nx-plugin-mcp 1.0.0-rc.98 → 1.0.1
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 +17 -9
- package/docs/get_started/building-with-ai.mdx +21 -14
- package/docs/get_started/concepts.mdx +1 -1
- package/docs/get_started/existing-project.mdx +7 -4
- package/docs/get_started/quick-start.mdx +153 -65
- package/docs/get_started/tutorials/contribute-generator.mdx +5 -5
- package/docs/get_started/tutorials/dungeon-game/1.mdx +17 -17
- package/docs/get_started/tutorials/dungeon-game/overview.mdx +5 -76
- package/docs/guides/agentcore-gateway.mdx +2 -26
- package/docs/guides/connection/agentcore-gateway-agent.mdx +1 -1
- package/docs/guides/connection/py-agent-a2a.mdx +2 -2
- package/docs/guides/connection/py-agent-gateway.mdx +1 -1
- package/docs/guides/connection/py-agent-mcp.mdx +1 -1
- package/docs/guides/connection/react-trpc.mdx +1 -1
- package/docs/guides/connection/react-ts-agent.mdx +1 -1
- package/docs/guides/open-api-py-client.mdx +270 -0
- package/docs/guides/py-dynamodb.mdx +7 -0
- package/docs/guides/react-website-auth.mdx +3 -33
- package/docs/guides/react-website.mdx +3 -28
- package/docs/guides/runtime-config.mdx +2 -34
- package/docs/guides/terraform-project.mdx +1 -1
- package/docs/guides/ts-dynamodb.mdx +7 -0
- package/docs/guides/ts-smithy-api.mdx +8 -47
- package/docs/guides/typescript-project.mdx +2 -2
- package/docs/guides/workspace.mdx +7 -10
- package/docs/snippets/agent/architecture.mdx +9 -52
- package/docs/snippets/agent/bedrock-deployment.mdx +1 -1
- package/docs/snippets/agent/runtime-arn.mdx +1 -1
- package/docs/snippets/api/access-logging.mdx +1 -1
- package/docs/snippets/api/api-architecture.mdx +4 -75
- package/docs/snippets/api/type-safe-api-integrations.mdx +2 -4
- package/docs/snippets/lambda-function/architecture.mdx +3 -29
- package/docs/snippets/mcp/architecture.mdx +9 -38
- package/docs/snippets/mcp/bedrock-deployment.mdx +1 -1
- package/docs/snippets/pdk-migration/example/01-migrate-api.mdx +8 -6
- package/docs/snippets/pdk-migration/example/02-migrate-website.mdx +7 -7
- package/docs/snippets/pdk-migration/example/03-migrate-infra.mdx +4 -3
- package/docs/snippets/pdk-migration/example/04-deploy.mdx +8 -7
- package/docs/snippets/pdk-migration/faq/type-safe-api.mdx +4 -4
- package/docs/snippets/prerequisites.mdx +0 -5
- package/docs/snippets/rdb/architecture.mdx +2 -33
- package/docs/snippets/recommended-prerequisites.mdx +1 -1
- package/docs/snippets/workspace-prerequisite.mdx +8 -0
- package/generators.json +7 -0
- package/package.json +1 -1
- package/src/agentcore-gateway/schema.json +1 -0
- package/src/open-api/py-client/schema.json +28 -0
- package/src/py/agent/schema.json +2 -0
- package/src/py/mcp-server/schema.json +1 -0
- package/src/ts/agent/schema.json +1 -0
- package/src/ts/api/schema.json +2 -0
- package/src/ts/mcp-server/schema.json +1 -0
- package/src/ts/react-website/app/schema.json +1 -0
- package/src/ts/website/app/schema.json +1 -0
|
@@ -10,6 +10,7 @@ import GeneratorParameters from '@components/generator-parameters.astro';
|
|
|
10
10
|
import NxCommands from '@components/nx-commands.astro';
|
|
11
11
|
import Infrastructure from '@components/infrastructure.astro';
|
|
12
12
|
import Snippet from '@components/snippet.astro';
|
|
13
|
+
import ArchitectureDiagram from '@components/architecture-diagram.astro';
|
|
13
14
|
|
|
14
15
|
The React Website Authentication generator adds authentication to your React website using [Amazon Cognito](https://aws.amazon.com/cognito/).
|
|
15
16
|
|
|
@@ -71,38 +72,7 @@ You will also find the following infrastructure code generated based on your sel
|
|
|
71
72
|
|
|
72
73
|
This generator adds an Amazon Cognito user pool (for sign-in) and an identity pool (for federating signed-in users to scoped IAM credentials) to the existing static-website architecture:
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
direction: right
|
|
76
|
-
|
|
77
|
-
browser: Web Browser {
|
|
78
|
-
shape: image
|
|
79
|
-
icon: /nx-plugin-for-aws/icons/aws/client.svg
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
waf: WAF {
|
|
83
|
-
shape: image
|
|
84
|
-
icon: /nx-plugin-for-aws/icons/aws/waf.svg
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
cognito: Cognito\n(User + Identity Pool) {
|
|
88
|
-
shape: image
|
|
89
|
-
icon: /nx-plugin-for-aws/icons/aws/cognito.svg
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
iam: Scoped IAM\nCredentials {
|
|
93
|
-
shape: image
|
|
94
|
-
icon: /nx-plugin-for-aws/icons/aws/iam.svg
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
backend: Authenticated\nAWS Resources {
|
|
98
|
-
shape: rectangle
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
browser -> waf: Sign in
|
|
102
|
-
waf -> cognito
|
|
103
|
-
cognito -> iam
|
|
104
|
-
browser -> backend: IAM/Cognito
|
|
105
|
-
```
|
|
75
|
+
<ArchitectureDiagram name="my-website" />
|
|
106
76
|
|
|
107
77
|
#### Threat protection
|
|
108
78
|
|
|
@@ -255,7 +225,7 @@ In order to grant authenticated users access to perform certain actions, such as
|
|
|
255
225
|
|
|
256
226
|
<Infrastructure>
|
|
257
227
|
<Fragment slot="cdk">
|
|
258
|
-
```ts title="packages/infra/src/stacks/application-stack.ts" {
|
|
228
|
+
```ts title="packages/infra/src/stacks/application-stack.ts" {14}
|
|
259
229
|
import { Stack, StackProps } from 'aws-cdk-lib';
|
|
260
230
|
import { Construct } from 'constructs';
|
|
261
231
|
import { MyWebsite, UserIdentity, MyApi } from '@my-scope/common-constructs';
|
|
@@ -17,6 +17,7 @@ import PackageManagerShortCommand from '@components/package-manager-short-comman
|
|
|
17
17
|
import Infrastructure from '@components/infrastructure.astro';
|
|
18
18
|
import Snippet from '@components/snippet.astro';
|
|
19
19
|
import OptionFilter from '@components/option-filter.astro';
|
|
20
|
+
import ArchitectureDiagram from '@components/architecture-diagram.astro';
|
|
20
21
|
|
|
21
22
|
This generator creates a new [React](https://react.dev/) website with [shadcn/ui](https://ui.shadcn.com/) configured by default, along with the AWS CDK or Terraform infrastructure to deploy your website to the cloud as a static website hosted in [S3](https://aws.amazon.com/s3/), served by [CloudFront](https://aws.amazon.com/cloudfront/) and protected by [WAF](https://aws.amazon.com/waf/).
|
|
22
23
|
|
|
@@ -106,35 +107,9 @@ The generator creates infrastructure as code for deploying your website based on
|
|
|
106
107
|
|
|
107
108
|
#### Architecture
|
|
108
109
|
|
|
109
|
-
The deployed website has the following architecture:
|
|
110
|
+
The deployed website has the following architecture: your built assets in an S3 bucket, served by a CloudFront distribution with an AWS WAFv2 Web ACL in front of it.
|
|
110
111
|
|
|
111
|
-
|
|
112
|
-
direction: right
|
|
113
|
-
|
|
114
|
-
browser: Web Browser {
|
|
115
|
-
shape: image
|
|
116
|
-
icon: /nx-plugin-for-aws/icons/aws/client.svg
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
waf: WAF {
|
|
120
|
-
shape: image
|
|
121
|
-
icon: /nx-plugin-for-aws/icons/aws/waf.svg
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
cloudfront: CloudFront {
|
|
125
|
-
shape: image
|
|
126
|
-
icon: /nx-plugin-for-aws/icons/aws/cloudfront.svg
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
s3: Static Assets\n(S3) {
|
|
130
|
-
shape: image
|
|
131
|
-
icon: /nx-plugin-for-aws/icons/aws/s3.svg
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
browser -> waf
|
|
135
|
-
waf -> cloudfront
|
|
136
|
-
cloudfront -> s3
|
|
137
|
-
```
|
|
112
|
+
<ArchitectureDiagram />
|
|
138
113
|
|
|
139
114
|
## Implementing your Website
|
|
140
115
|
|
|
@@ -5,6 +5,7 @@ description: How runtime configuration connects your generated projects using AW
|
|
|
5
5
|
import { Tabs, TabItem, Steps } from '@astrojs/starlight/components';
|
|
6
6
|
import Infrastructure from '@components/infrastructure.astro';
|
|
7
7
|
import Link from '@components/link.astro';
|
|
8
|
+
import EmbeddedGraph from '@components/embedded-graph.astro';
|
|
8
9
|
|
|
9
10
|
Runtime configuration is the mechanism used by Nx Plugin for AWS to pass deploy-time values between generated projects and components so they can connect to one another. For example, when you generate an API, its URL is automatically registered in the runtime configuration so that a connected website can discover it.
|
|
10
11
|
|
|
@@ -26,40 +27,7 @@ The `connection` namespace is also deployed as a `runtime-config.json` file to y
|
|
|
26
27
|
|
|
27
28
|
You can define as many additional namespaces as you like, providing a convenient alternative to environment variables for passing deploy-time values to your Lambda functions or other compute resources.
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
direction: down
|
|
31
|
-
|
|
32
|
-
iac: "Infrastructure as code\nRuntimeConfig.set(...)"
|
|
33
|
-
|
|
34
|
-
appconfig: "AWS AppConfig" {
|
|
35
|
-
shape: cylinder
|
|
36
|
-
connection: "connection namespace"
|
|
37
|
-
agentcore: "agentcore namespace"
|
|
38
|
-
custom: "custom namespaces"
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
s3: "website S3 bucket" {
|
|
42
|
-
shape: cylinder
|
|
43
|
-
rcj: runtime-config.json {
|
|
44
|
-
shape: page
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
website: React website
|
|
49
|
-
|
|
50
|
-
server: Lambda / agent
|
|
51
|
-
|
|
52
|
-
iac -> appconfig.connection
|
|
53
|
-
iac -> appconfig.agentcore
|
|
54
|
-
iac -> appconfig.custom
|
|
55
|
-
|
|
56
|
-
appconfig.connection -> s3.rcj: deployed
|
|
57
|
-
s3.rcj -> website: fetched at load
|
|
58
|
-
|
|
59
|
-
appconfig.connection -> server
|
|
60
|
-
appconfig.agentcore -> server: Powertools getAppConfig
|
|
61
|
-
appconfig.custom -> server
|
|
62
|
-
```
|
|
30
|
+
<EmbeddedGraph diagram="runtime-config" />
|
|
63
31
|
|
|
64
32
|
## Infrastructure
|
|
65
33
|
|
|
@@ -89,7 +89,7 @@ Application projects include full deployment capabilities with remote state mana
|
|
|
89
89
|
|
|
90
90
|
You can start writing your Terraform infrastructure inside `src/main.tf`, for example:
|
|
91
91
|
|
|
92
|
-
```diff title="src/main.tf"
|
|
92
|
+
```diff title="src/main.tf"
|
|
93
93
|
-locals {
|
|
94
94
|
- account_id = data.aws_caller_identity.current.account_id
|
|
95
95
|
- aws_region = data.aws_region.current.id
|
|
@@ -11,6 +11,7 @@ import Link from '@components/link.astro';
|
|
|
11
11
|
import RunGenerator from '@components/run-generator.astro';
|
|
12
12
|
import GeneratorParameters from '@components/generator-parameters.astro';
|
|
13
13
|
import Snippet from '@components/snippet.astro';
|
|
14
|
+
import ArchitectureDiagram from '@components/architecture-diagram.astro';
|
|
14
15
|
|
|
15
16
|
This generator creates a new TypeScript DynamoDB project backed by [Amazon DynamoDB](https://aws.amazon.com/dynamodb/), using [ElectroDB](https://electrodb.dev/) for type-safe entity modelling. It generates the application code and infrastructure needed to provision and manage a DynamoDB table using AWS CDK or Terraform, with single-table design support and built-in local development via DynamoDB Local.
|
|
16
17
|
|
|
@@ -53,6 +54,12 @@ The local development scripts are shared across all DynamoDB projects (both Type
|
|
|
53
54
|
|
|
54
55
|
<Snippet name="dynamodb/infrastructure" />
|
|
55
56
|
|
|
57
|
+
#### Architecture
|
|
58
|
+
|
|
59
|
+
The deployed project provisions the table itself, which any project it is connected to reads and writes:
|
|
60
|
+
|
|
61
|
+
<ArchitectureDiagram />
|
|
62
|
+
|
|
56
63
|
## Local Development
|
|
57
64
|
|
|
58
65
|
### Starting Local DynamoDB
|
|
@@ -20,6 +20,7 @@ import Snippet from '@components/snippet.astro';
|
|
|
20
20
|
import OptionFilter from '@components/option-filter.astro';
|
|
21
21
|
import InstallCommand from '@components/install-command.astro';
|
|
22
22
|
import { TS_VERSIONS } from '../../../../../../packages/nx-plugin/src/utils/versions';
|
|
23
|
+
import ArchitectureDiagram from '@components/architecture-diagram.astro';
|
|
23
24
|
|
|
24
25
|
[Smithy](https://smithy.io/) is a protocol-agnostic interface definition language for authoring APIs in a model driven fashion.
|
|
25
26
|
|
|
@@ -126,47 +127,7 @@ This project is generated using the <Link path="/guides/terraform-project">`terr
|
|
|
126
127
|
|
|
127
128
|
The deployed Smithy API has the following architecture, with an [AWS WAFv2](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html) Web ACL in front of the API Gateway stage:
|
|
128
129
|
|
|
129
|
-
|
|
130
|
-
direction: right
|
|
131
|
-
|
|
132
|
-
client: Client {
|
|
133
|
-
shape: image
|
|
134
|
-
icon: /nx-plugin-for-aws/icons/aws/client.svg
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
waf: WAF {
|
|
138
|
-
shape: image
|
|
139
|
-
icon: /nx-plugin-for-aws/icons/aws/waf.svg
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
apigw: API Gateway\n(REST API) {
|
|
143
|
-
shape: image
|
|
144
|
-
icon: /nx-plugin-for-aws/icons/aws/api-gateway.svg
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
lambda: Lambda\n(Smithy Server SDK) {
|
|
148
|
-
shape: image
|
|
149
|
-
icon: /nx-plugin-for-aws/icons/aws/lambda.svg
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
cw: CloudWatch\n(Logs, Metrics) {
|
|
153
|
-
shape: image
|
|
154
|
-
icon: /nx-plugin-for-aws/icons/aws/cloudwatch.svg
|
|
155
|
-
near: top-right
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
xray: X-Ray\n(Traces) {
|
|
159
|
-
shape: image
|
|
160
|
-
icon: /nx-plugin-for-aws/icons/aws/xray.svg
|
|
161
|
-
near: bottom-right
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
client -> waf
|
|
165
|
-
waf -> apigw
|
|
166
|
-
apigw -> lambda
|
|
167
|
-
lambda -> cw
|
|
168
|
-
lambda -> xray
|
|
169
|
-
```
|
|
130
|
+
<ArchitectureDiagram options={{ infra: 'rest-lambda' }} />
|
|
170
131
|
|
|
171
132
|
## Implementing your Smithy API
|
|
172
133
|
|
|
@@ -315,7 +276,7 @@ You must construct the context yourself in both `handler.ts` (the Lambda functio
|
|
|
315
276
|
|
|
316
277
|
The generator configures structured logging using AWS Lambda Powertools with automatic context injection via Middy middleware.
|
|
317
278
|
|
|
318
|
-
```typescript {
|
|
279
|
+
```typescript {4}
|
|
319
280
|
// handler.ts
|
|
320
281
|
export const handler = middy<APIGatewayProxyEvent, APIGatewayProxyResult>()
|
|
321
282
|
.use(captureLambdaHandler(tracer))
|
|
@@ -326,7 +287,7 @@ export const handler = middy<APIGatewayProxyEvent, APIGatewayProxyResult>()
|
|
|
326
287
|
|
|
327
288
|
You can reference the logger from your operation implementations via the context:
|
|
328
289
|
|
|
329
|
-
```typescript {
|
|
290
|
+
```typescript {6}
|
|
330
291
|
// operations/echo.ts
|
|
331
292
|
import { ServiceContext } from '../context.js';
|
|
332
293
|
import { Echo as EchoOperation } from '../generated/ssdk/index.js';
|
|
@@ -341,7 +302,7 @@ export const Echo: EchoOperation<ServiceContext> = async (input, ctx) => {
|
|
|
341
302
|
|
|
342
303
|
AWS X-Ray tracing is configured automatically via the `captureLambdaHandler` middleware.
|
|
343
304
|
|
|
344
|
-
```typescript {
|
|
305
|
+
```typescript {3}
|
|
345
306
|
// handler.ts
|
|
346
307
|
export const handler = middy<APIGatewayProxyEvent, APIGatewayProxyResult>()
|
|
347
308
|
.use(captureLambdaHandler(tracer))
|
|
@@ -352,7 +313,7 @@ export const handler = middy<APIGatewayProxyEvent, APIGatewayProxyResult>()
|
|
|
352
313
|
|
|
353
314
|
You can add custom subsegments to your traces in your operations:
|
|
354
315
|
|
|
355
|
-
```typescript {
|
|
316
|
+
```typescript {7, 11, 14}
|
|
356
317
|
// operations/echo.ts
|
|
357
318
|
import { ServiceContext } from '../context.js';
|
|
358
319
|
import { Echo as EchoOperation } from '../generated/ssdk/index.js';
|
|
@@ -375,7 +336,7 @@ export const Echo: EchoOperation<ServiceContext> = async (input, ctx) => {
|
|
|
375
336
|
|
|
376
337
|
CloudWatch metrics are collected automatically for each request via the `logMetrics` middleware.
|
|
377
338
|
|
|
378
|
-
```typescript {
|
|
339
|
+
```typescript {5}
|
|
379
340
|
// handler.ts
|
|
380
341
|
export const handler = middy<APIGatewayProxyEvent, APIGatewayProxyResult>()
|
|
381
342
|
.use(captureLambdaHandler(tracer))
|
|
@@ -386,7 +347,7 @@ export const handler = middy<APIGatewayProxyEvent, APIGatewayProxyResult>()
|
|
|
386
347
|
|
|
387
348
|
You can add custom metrics in your operations:
|
|
388
349
|
|
|
389
|
-
```typescript {
|
|
350
|
+
```typescript {7}
|
|
390
351
|
// operations/echo.ts
|
|
391
352
|
import { MetricUnit } from '@aws-lambda-powertools/metrics';
|
|
392
353
|
import { ServiceContext } from '../context.js';
|
|
@@ -228,9 +228,9 @@ npm has no catalog feature, so versions are declared directly in each `package.j
|
|
|
228
228
|
|
|
229
229
|
##### Opting out of catalogs
|
|
230
230
|
|
|
231
|
-
Catalogs are enabled by default. To turn them off, create your workspace with `--catalog
|
|
231
|
+
Catalogs are enabled by default. To turn them off, create your workspace with `--catalog=false`:
|
|
232
232
|
|
|
233
|
-
<CreateNxWorkspaceCommand workspace="my-project"
|
|
233
|
+
<CreateNxWorkspaceCommand workspace="my-project" values={{ catalog: false }} />
|
|
234
234
|
|
|
235
235
|
Or set it in `aws-nx-plugin.config.mts` at any time:
|
|
236
236
|
|
|
@@ -27,6 +27,7 @@ When you create a new workspace with `@aws/nx-plugin`, the preset generator sets
|
|
|
27
27
|
- package.json Root package.json for your monorepo
|
|
28
28
|
- nx.json Nx configuration (common targets, sync generators, caching)
|
|
29
29
|
- tsconfig.base.json Root TypeScript configuration
|
|
30
|
+
- biome.json Biome configuration for linting and formatting
|
|
30
31
|
- aws-nx-plugin.config.mts Nx Plugin for AWS configuration
|
|
31
32
|
- .git-secrets/ Vendored git-secrets bash script for credential scanning
|
|
32
33
|
- .gitallowed Patterns git-secrets treats as false positives
|
|
@@ -72,7 +73,7 @@ For details on how TypeScript and Python projects are set up, refer to the <Link
|
|
|
72
73
|
|
|
73
74
|
### Caching
|
|
74
75
|
|
|
75
|
-
Nx caches the output of previously executed targets and replays them when the inputs haven't changed. This dramatically speeds up builds, tests, and linting
|
|
76
|
+
Nx caches the output of previously executed targets and replays them when the inputs haven't changed. This dramatically speeds up builds, tests, and linting. If you encounter stale or unexpected behaviour, reset the cache with:
|
|
76
77
|
|
|
77
78
|
<NxCommands commands={['reset']} />
|
|
78
79
|
|
|
@@ -88,15 +89,7 @@ New workspaces set `parallel` in `nx.json`, which controls how many tasks Nx run
|
|
|
88
89
|
}
|
|
89
90
|
```
|
|
90
91
|
|
|
91
|
-
Lower it if you're building on a machine with fewer cores or limited memory:
|
|
92
|
-
|
|
93
|
-
```json title="nx.json"
|
|
94
|
-
{
|
|
95
|
-
"parallel": 3
|
|
96
|
-
}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
You can also override it per-invocation:
|
|
92
|
+
Lower it if you're building on a machine with fewer cores or limited memory. You can also override it per-invocation:
|
|
100
93
|
|
|
101
94
|
<NxCommands commands={['run-many --target build --parallel=4']} />
|
|
102
95
|
|
|
@@ -166,6 +159,10 @@ This will run the chosen target as well as the targets it depends on.
|
|
|
166
159
|
|
|
167
160
|
New workspaces are configured with [Biome](https://biomejs.dev/) for static analysis and code formatting. Running `lint` checks all projects for issues, and `lint --configuration=fix` auto-fixes them.
|
|
168
161
|
|
|
162
|
+
### MCP Configuration
|
|
163
|
+
|
|
164
|
+
The plugin's <Link path="get_started/building-with-ai">MCP server</Link> is configured as a project level MCP server for Claude Code, Cursor, Kiro, Gemini CLI, GitHub Copilot and OpenAI Codex, so your coding assistant can discover and run the plugin's generators without any setup. The configuration is committed with your workspace, giving everyone on your team the same setup. Remove any configurations for coding assistants you and your team do not use.
|
|
165
|
+
|
|
169
166
|
### Git Secrets
|
|
170
167
|
|
|
171
168
|
Workspaces are set up with [git-secrets](https://github.com/awslabs/git-secrets) pre-commit hooks that scan staged files for AWS credential patterns before each commit. This prevents accidentally committing access keys, secret keys, and other sensitive values.
|
|
@@ -2,71 +2,28 @@
|
|
|
2
2
|
title: Agent Architecture
|
|
3
3
|
---
|
|
4
4
|
import { Tabs, TabItem } from '@astrojs/starlight/components';
|
|
5
|
+
import ArchitectureDiagram from '@components/architecture-diagram.astro';
|
|
5
6
|
|
|
6
7
|
<Tabs syncKey="infra">
|
|
7
|
-
<TabItem label="
|
|
8
|
+
<TabItem label="AgentCore Runtime" _filter={{ infra: 'agentcore' }}>
|
|
8
9
|
|
|
9
|
-
When deployed to [Bedrock AgentCore Runtime](https://aws.amazon.com/bedrock/agentcore/),
|
|
10
|
+
When deployed to [Bedrock AgentCore Runtime](https://aws.amazon.com/bedrock/agentcore/), your agent's code is packaged as a zip and run in the AgentCore managed runtime. Clients invoke the AgentCore Runtime data plane endpoint, which forwards requests to your agent. The agent calls Amazon Bedrock for model inference and may invoke tools, MCP servers, or downstream APIs.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
direction: right
|
|
12
|
+
<ArchitectureDiagram options={{ infra: 'agentcore' }} />
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
icon: /nx-plugin-for-aws/icons/aws/client.svg
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
ecr: ECR {
|
|
20
|
-
shape: image
|
|
21
|
-
icon: /nx-plugin-for-aws/icons/aws/ecr.svg
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
agentcore: Strands Agent\n(AgentCore Runtime) {
|
|
25
|
-
shape: image
|
|
26
|
-
icon: /nx-plugin-for-aws/icons/aws/bedrock-agentcore-runtime.svg
|
|
27
|
-
}
|
|
14
|
+
</TabItem>
|
|
15
|
+
<TabItem label="AgentCore Runtime (container)" _filter={{ infra: 'agentcore-ecr' }}>
|
|
28
16
|
|
|
29
|
-
|
|
30
|
-
shape: image
|
|
31
|
-
icon: /nx-plugin-for-aws/icons/aws/bedrock.svg
|
|
32
|
-
near: top-right
|
|
33
|
-
}
|
|
17
|
+
With `infra: agentcore-ecr`, the agent is built into a container image, pushed to Amazon ECR and run in AgentCore Runtime. This gives you OS-level control over the runtime environment, at the cost of a longer build and deploy cycle than the zip packaging above.
|
|
34
18
|
|
|
35
|
-
|
|
36
|
-
shape: image
|
|
37
|
-
icon: /nx-plugin-for-aws/icons/aws/cloudwatch.svg
|
|
38
|
-
near: bottom-right
|
|
39
|
-
}
|
|
19
|
+
<ArchitectureDiagram options={{ infra: 'agentcore-ecr' }} />
|
|
40
20
|
|
|
41
|
-
client -> agentcore
|
|
42
|
-
ecr -> agentcore: Container\nimage
|
|
43
|
-
agentcore -> bedrock: InvokeModel
|
|
44
|
-
agentcore -> cw
|
|
45
|
-
```
|
|
46
21
|
</TabItem>
|
|
47
22
|
<TabItem label="None (local only)" _filter={{ infra: 'none' }}>
|
|
48
23
|
|
|
49
24
|
With `infra: none`, no AWS infrastructure is generated. The agent runs as a local process and calls Amazon Bedrock for model inference.
|
|
50
25
|
|
|
51
|
-
|
|
52
|
-
direction: right
|
|
53
|
-
|
|
54
|
-
client: Client {
|
|
55
|
-
shape: image
|
|
56
|
-
icon: /nx-plugin-for-aws/icons/aws/client.svg
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
agent: Strands Agent\n(local process) {
|
|
60
|
-
shape: rectangle
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
bedrock: Bedrock\n(Model Inference) {
|
|
64
|
-
shape: image
|
|
65
|
-
icon: /nx-plugin-for-aws/icons/aws/bedrock.svg
|
|
66
|
-
}
|
|
26
|
+
<ArchitectureDiagram options={{ infra: 'none' }} />
|
|
67
27
|
|
|
68
|
-
client -> agent
|
|
69
|
-
agent -> bedrock: InvokeModel
|
|
70
|
-
```
|
|
71
28
|
</TabItem>
|
|
72
29
|
</Tabs>
|
|
@@ -16,7 +16,7 @@ The account role is managed by the `ApiGatewayAccount` construct, a stack-scoped
|
|
|
16
16
|
|
|
17
17
|
The access log format is set by the `RestApi` construct your API extends. To customise it, pass `deployOptions` through to `super` in the generated `packages/common/constructs/src/app/apis/my-api.ts`, keeping the `tracingEnabled` the construct already sets:
|
|
18
18
|
|
|
19
|
-
```ts {
|
|
19
|
+
```ts {4-7} title="packages/common/constructs/src/app/apis/my-api.ts"
|
|
20
20
|
super(scope, id, {
|
|
21
21
|
apiName: 'MyApi',
|
|
22
22
|
// ...
|
|
@@ -2,91 +2,20 @@
|
|
|
2
2
|
title: API Architecture
|
|
3
3
|
---
|
|
4
4
|
import { Tabs, TabItem } from '@astrojs/starlight/components';
|
|
5
|
+
import ArchitectureDiagram from '@components/architecture-diagram.astro';
|
|
5
6
|
|
|
6
|
-
The deployed application has the following architecture:
|
|
7
|
+
The deployed application has the following architecture: an API Gateway API in front of a Lambda function running your handler.
|
|
7
8
|
|
|
8
9
|
<Tabs syncKey="http-rest">
|
|
9
10
|
<TabItem label="REST API" _filter={{ infra: 'rest-lambda' }}>
|
|
10
|
-
```d2 inline=true
|
|
11
|
-
direction: right
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
shape: image
|
|
15
|
-
icon: /nx-plugin-for-aws/icons/aws/client.svg
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
waf: WAF {
|
|
19
|
-
shape: image
|
|
20
|
-
icon: /nx-plugin-for-aws/icons/aws/waf.svg
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
apigw: API Gateway\n(REST API) {
|
|
24
|
-
shape: image
|
|
25
|
-
icon: /nx-plugin-for-aws/icons/aws/api-gateway.svg
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
lambda: Lambda {
|
|
29
|
-
shape: image
|
|
30
|
-
icon: /nx-plugin-for-aws/icons/aws/lambda.svg
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
cw: CloudWatch\n(Logs, Metrics) {
|
|
34
|
-
shape: image
|
|
35
|
-
icon: /nx-plugin-for-aws/icons/aws/cloudwatch.svg
|
|
36
|
-
near: top-right
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
xray: X-Ray\n(Traces) {
|
|
40
|
-
shape: image
|
|
41
|
-
icon: /nx-plugin-for-aws/icons/aws/xray.svg
|
|
42
|
-
near: bottom-right
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
client -> waf
|
|
46
|
-
waf -> apigw
|
|
47
|
-
apigw -> lambda
|
|
48
|
-
lambda -> cw
|
|
49
|
-
lambda -> xray
|
|
50
|
-
```
|
|
12
|
+
<ArchitectureDiagram options={{ infra: 'rest-lambda' }} />
|
|
51
13
|
|
|
52
14
|
REST APIs include an [AWS WAFv2](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html) Web ACL in front of the API Gateway stage with the AWS managed default ruleset enabled.
|
|
53
15
|
</TabItem>
|
|
54
16
|
<TabItem label="HTTP API" _filter={{ infra: 'http-lambda' }}>
|
|
55
|
-
```d2 inline=true
|
|
56
|
-
direction: right
|
|
57
|
-
|
|
58
|
-
client: Client {
|
|
59
|
-
shape: image
|
|
60
|
-
icon: /nx-plugin-for-aws/icons/aws/client.svg
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
apigw: API Gateway\n(HTTP API) {
|
|
64
|
-
shape: image
|
|
65
|
-
icon: /nx-plugin-for-aws/icons/aws/api-gateway.svg
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
lambda: Lambda {
|
|
69
|
-
shape: image
|
|
70
|
-
icon: /nx-plugin-for-aws/icons/aws/lambda.svg
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
cw: CloudWatch\n(Logs, Metrics) {
|
|
74
|
-
shape: image
|
|
75
|
-
icon: /nx-plugin-for-aws/icons/aws/cloudwatch.svg
|
|
76
|
-
near: top-right
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
xray: X-Ray\n(Traces) {
|
|
80
|
-
shape: image
|
|
81
|
-
icon: /nx-plugin-for-aws/icons/aws/xray.svg
|
|
82
|
-
near: bottom-right
|
|
83
|
-
}
|
|
84
17
|
|
|
85
|
-
|
|
86
|
-
apigw -> lambda
|
|
87
|
-
lambda -> cw
|
|
88
|
-
lambda -> xray
|
|
89
|
-
```
|
|
18
|
+
<ArchitectureDiagram options={{ infra: 'http-lambda' }} />
|
|
90
19
|
|
|
91
20
|
HTTP APIs do not support WAF directly — if you need WAF protection, choose REST API instead or front the HTTP API with a CloudFront distribution.
|
|
92
21
|
</TabItem>
|
|
@@ -5,7 +5,6 @@ import { Steps } from '@astrojs/starlight/components';
|
|
|
5
5
|
import Infrastructure from '@components/infrastructure.astro';
|
|
6
6
|
import Drawer from '@components/drawer.astro';
|
|
7
7
|
import OptionFilter from '@components/option-filter.astro';
|
|
8
|
-
import RunGenerator from '@components/run-generator.astro';
|
|
9
8
|
|
|
10
9
|
The REST/HTTP API CDK constructs are configured to provide a type-safe interface for defining integrations for each of your operations.
|
|
11
10
|
|
|
@@ -405,7 +404,7 @@ Generated APIs support two integration patterns:
|
|
|
405
404
|
<Fragment slot="cdk">
|
|
406
405
|
The integration pattern can be changed at any time in CDK by updating your API construct. For example, setting `pattern` to `'shared'` creates a single function instead of one per integration:
|
|
407
406
|
|
|
408
|
-
```ts {
|
|
407
|
+
```ts {7}
|
|
409
408
|
// packages/common/constructs/src/app/apis/my-api.ts
|
|
410
409
|
export class MyApi<...> extends ... {
|
|
411
410
|
|
|
@@ -424,8 +423,7 @@ Unlike CDK, the integration pattern is baked into the generated module. To chang
|
|
|
424
423
|
|
|
425
424
|
<Steps>
|
|
426
425
|
1. Delete the previously generated API module in `packages/common/terraform/src/app/apis`
|
|
427
|
-
2. Re-run the API
|
|
428
|
-
<RunGenerator generator="ts#api" requiredParameters={{ integrationPattern: 'shared' }} />
|
|
426
|
+
2. Re-run the generator that created your API with the other integration pattern (eg `--integrationPattern=shared`)
|
|
429
427
|
</Steps>
|
|
430
428
|
|
|
431
429
|
With the `isolated` pattern, the module reads the operations from a generated file:
|
|
@@ -1,36 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Lambda Function Architecture
|
|
3
3
|
---
|
|
4
|
+
import ArchitectureDiagram from '@components/architecture-diagram.astro';
|
|
4
5
|
|
|
5
|
-
The deployed function has the following architecture:
|
|
6
|
+
The deployed function has the following architecture, with its logs, metrics and traces going to CloudWatch and X-Ray:
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
direction: right
|
|
9
|
-
|
|
10
|
-
source: Event Source\n(SNS, SQS, ...) {
|
|
11
|
-
shape: rectangle
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
lambda: Lambda {
|
|
15
|
-
shape: image
|
|
16
|
-
icon: /nx-plugin-for-aws/icons/aws/lambda.svg
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
cw: CloudWatch\n(Logs, Metrics) {
|
|
20
|
-
shape: image
|
|
21
|
-
icon: /nx-plugin-for-aws/icons/aws/cloudwatch.svg
|
|
22
|
-
near: top-right
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
xray: X-Ray\n(Traces) {
|
|
26
|
-
shape: image
|
|
27
|
-
icon: /nx-plugin-for-aws/icons/aws/xray.svg
|
|
28
|
-
near: bottom-right
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
source -> lambda
|
|
32
|
-
lambda -> cw
|
|
33
|
-
lambda -> xray
|
|
34
|
-
```
|
|
8
|
+
<ArchitectureDiagram name="my-function" />
|
|
35
9
|
|
|
36
10
|
The generator vends the function itself; you wire the event source up in your stack to invoke it (for example, an API Gateway integration, an EventBridge rule, an S3 notification or an SQS event source mapping).
|