@aws/nx-plugin-mcp 1.0.0 → 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/existing-project.mdx +1 -1
- package/docs/get_started/quick-start.mdx +38 -54
- 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 +4 -70
- 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 +1 -1
- package/docs/snippets/pdk-migration/example/02-migrate-website.mdx +5 -6
- package/docs/snippets/pdk-migration/example/03-migrate-infra.mdx +1 -1
- package/docs/snippets/pdk-migration/faq/type-safe-api.mdx +2 -2
- package/docs/snippets/rdb/architecture.mdx +2 -33
- 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
|
@@ -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).
|
|
@@ -2,57 +2,28 @@
|
|
|
2
2
|
title: MCP Server 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 server's code is packaged as a zip and run in the AgentCore managed runtime. AI assistants invoke the AgentCore Runtime data plane endpoint, which forwards `tools/*` and `resources/*` calls to your server over the [streamable HTTP transport](https://modelcontextprotocol.io/specification/draft/basic/transports#streamable-http).
|
|
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
|
-
}
|
|
14
|
+
</TabItem>
|
|
15
|
+
<TabItem label="AgentCore Runtime (container)" _filter={{ infra: 'agentcore-ecr' }}>
|
|
23
16
|
|
|
24
|
-
|
|
25
|
-
shape: image
|
|
26
|
-
icon: /nx-plugin-for-aws/icons/aws/bedrock-agentcore-runtime.svg
|
|
27
|
-
}
|
|
17
|
+
With `infra: agentcore-ecr`, the MCP server 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.
|
|
28
18
|
|
|
29
|
-
|
|
30
|
-
shape: image
|
|
31
|
-
icon: /nx-plugin-for-aws/icons/aws/cloudwatch.svg
|
|
32
|
-
}
|
|
19
|
+
<ArchitectureDiagram options={{ infra: 'agentcore-ecr' }} />
|
|
33
20
|
|
|
34
|
-
assistant -> agentcore: Streamable\nHTTP
|
|
35
|
-
ecr -> agentcore: Container\nimage
|
|
36
|
-
agentcore -> cw
|
|
37
|
-
```
|
|
38
21
|
</TabItem>
|
|
39
22
|
<TabItem label="None (local only)" _filter={{ infra: 'none' }}>
|
|
40
23
|
|
|
41
24
|
With `infra: none`, no AWS infrastructure is generated. The MCP server is configured for local STDIO and HTTP transports only, and is consumed by AI assistants running on the same machine.
|
|
42
25
|
|
|
43
|
-
|
|
44
|
-
direction: right
|
|
45
|
-
|
|
46
|
-
assistant: AI Assistant {
|
|
47
|
-
shape: image
|
|
48
|
-
icon: /nx-plugin-for-aws/icons/aws/client.svg
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
server: MCP Server\n(local process) {
|
|
52
|
-
shape: rectangle
|
|
53
|
-
}
|
|
26
|
+
<ArchitectureDiagram options={{ infra: 'none' }} />
|
|
54
27
|
|
|
55
|
-
assistant -> server: STDIO\nor\nStreamable HTTP
|
|
56
|
-
```
|
|
57
28
|
</TabItem>
|
|
58
29
|
</Tabs>
|
|
@@ -106,7 +106,7 @@ export class ExampleStack extends Stack {
|
|
|
106
106
|
```
|
|
107
107
|
</Fragment>
|
|
108
108
|
<Fragment slot="terraform">
|
|
109
|
-
```terraform {
|
|
109
|
+
```terraform {6-7}
|
|
110
110
|
# MCP Server
|
|
111
111
|
module "my_project_mcp_server" {
|
|
112
112
|
# Relative path to the generated module in the common/terraform project
|
|
@@ -26,7 +26,7 @@ If you used OpenAPI or TypeSpec as your modelling language, or have handlers imp
|
|
|
26
26
|
|
|
27
27
|
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`:
|
|
28
28
|
|
|
29
|
-
<RunGenerator generator="ts#api" noInteractive requiredParameters={{ name: 'api', framework: 'smithy', namespace: 'com.aws', auth: 'iam' }} />
|
|
29
|
+
<RunGenerator generator="ts#api" noInteractive requiredParameters={{ name: 'api', framework: 'smithy', namespace: 'com.aws', auth: 'iam' }} noOptions />
|
|
30
30
|
|
|
31
31
|
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.
|
|
32
32
|
|
|
@@ -20,13 +20,13 @@ As part of the migration, we will also move from PDK's configured React Router t
|
|
|
20
20
|
|
|
21
21
|
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`):
|
|
22
22
|
|
|
23
|
-
<RunGenerator generator="ts#website" noInteractive requiredParameters={{ name: 'website', framework: 'react', ux: 'cloudscape' }} />
|
|
23
|
+
<RunGenerator generator="ts#website" noInteractive requiredParameters={{ name: 'website', framework: 'react', ux: 'cloudscape' }} noOptions />
|
|
24
24
|
|
|
25
25
|
#### Add Cognito Authentication
|
|
26
26
|
|
|
27
27
|
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>.
|
|
28
28
|
|
|
29
|
-
<RunGenerator generator="ts#website#auth" noInteractive requiredParameters={{ project: 'website', cognitoDomain: 'shopping-list' }} />
|
|
29
|
+
<RunGenerator generator="ts#website#auth" noInteractive requiredParameters={{ project: 'website', cognitoDomain: 'shopping-list' }} noOptions />
|
|
30
30
|
|
|
31
31
|
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`.
|
|
32
32
|
|
|
@@ -34,13 +34,12 @@ This adds React components which manage the appropriate redirects to ensure user
|
|
|
34
34
|
The PDK `CloudscapeReactTsWebsiteProject` relied on `@aws-northstar/ui` to provide Cognito login components in-app. If you would prefer to use this approach instead of moving to the hosted UI, you can replace the generated `packages/common/constructs/src/core/user-identity.ts` with the [implementation from PDK](https://github.com/aws/aws-pdk/blob/mainline/packages/identity/src/user-identity.ts), replacing the constructs from `@aws-cdk/aws-cognito-identitypool-alpha` with those vended by `aws-cdk-lib`, and make sure to set the relevant values in `RuntimeConfig`:
|
|
35
35
|
|
|
36
36
|
```ts
|
|
37
|
-
RuntimeConfig.ensure(this).
|
|
38
|
-
...RuntimeConfig.ensure(this).config,
|
|
37
|
+
RuntimeConfig.ensure(this).set('connection', 'cognitoProps', {
|
|
39
38
|
region: Stack.of(this).region,
|
|
40
39
|
identityPoolId: this.identityPool.identityPoolId,
|
|
41
40
|
userPoolId: this.userPool.userPoolId,
|
|
42
41
|
userPoolWebClientId: this.userPoolClient.userPoolClientId,
|
|
43
|
-
};
|
|
42
|
+
});
|
|
44
43
|
```
|
|
45
44
|
|
|
46
45
|
You can then reuse the `Auth` component from your `CloudscapeReactTsWebsiteProject`.
|
|
@@ -52,7 +51,7 @@ In PDK you could pass the vended Projen projects to one another to trigger integ
|
|
|
52
51
|
|
|
53
52
|
With the Nx Plugin for AWS, API integration is supported via the <Link path="/guides/connection">`connection` generator</Link>. Next, we use this generator so that our website can invoke our Smithy API:
|
|
54
53
|
|
|
55
|
-
<RunGenerator generator="connection" noInteractive requiredParameters={{ sourceProject: 'website', targetProject: 'api' }} />
|
|
54
|
+
<RunGenerator generator="connection" noInteractive requiredParameters={{ sourceProject: 'website', targetProject: 'api' }} noOptions />
|
|
56
55
|
|
|
57
56
|
This generates the necessary client providers and build targets for your website to call your API via a generated TypeScript client.
|
|
58
57
|
|
|
@@ -22,7 +22,7 @@ A big advantage of the Nx Plugin for AWS over PDK is that the CDK constructs it
|
|
|
22
22
|
|
|
23
23
|
Run the <Link path="/guides/typescript-infrastructure">`ts#infra` generator</Link> to set up your infrastructure project in `packages/infra`:
|
|
24
24
|
|
|
25
|
-
<RunGenerator generator="ts#infra" noInteractive requiredParameters={{ name: 'infra' }} />
|
|
25
|
+
<RunGenerator generator="ts#infra" noInteractive requiredParameters={{ name: 'infra' }} noOptions />
|
|
26
26
|
|
|
27
27
|
#### Migrate the CDK Infrastructure
|
|
28
28
|
|
|
@@ -79,7 +79,7 @@ Type Safe API provided a Projen project type named `SmithyShapeLibraryProject` w
|
|
|
79
79
|
|
|
80
80
|
The equivalent is the <Link path="/guides/smithy-project">`smithy#project` generator</Link> with `type` set to `shapes`:
|
|
81
81
|
|
|
82
|
-
<RunGenerator generator="smithy#project" requiredParameters={{ name: 'my-shapes', type: 'shapes' }} />
|
|
82
|
+
<RunGenerator generator="smithy#project" requiredParameters={{ name: 'my-shapes', type: 'shapes' }} noOptions />
|
|
83
83
|
|
|
84
84
|
Move the shapes from your `SmithyShapeLibraryProject` into the generated project's `src` folder, then refer to the <Link path="/guides/smithy-project#depending-on-a-shape-library">Smithy project guide</Link> for how to wire the library up as a dependency of your API's model.
|
|
85
85
|
|
|
@@ -167,7 +167,7 @@ new Api(this, 'MyApi', {
|
|
|
167
167
|
|
|
168
168
|
You will need to "stub" your service/router for your service to compile if using the `ts#smithy-api` and the TypeScript Server SDK, eg:
|
|
169
169
|
|
|
170
|
-
```ts {
|
|
170
|
+
```ts {4}
|
|
171
171
|
// service.ts
|
|
172
172
|
export const Service: ApiService<ServiceContext> = {
|
|
173
173
|
...
|
|
@@ -1,39 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: RDB Architecture
|
|
3
3
|
---
|
|
4
|
+
import ArchitectureDiagram from '@components/architecture-diagram.astro';
|
|
4
5
|
|
|
5
6
|
The deployed database has the following architecture. By default, an [Amazon RDS Proxy](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy.html) sits in front of the Aurora cluster to pool connections and to enable [IAM authentication](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html) — see [Disable RDS Proxy](#disable-rds-proxy) for the alternative. The architecture is the same whether you select the PostgreSQL or MySQL engine; only the Aurora engine flavor differs.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
direction: right
|
|
9
|
-
|
|
10
|
-
app: Application\n(Lambda, Agent, ...) {
|
|
11
|
-
shape: hexagon
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
proxy: RDS Proxy {
|
|
15
|
-
shape: image
|
|
16
|
-
icon: /nx-plugin-for-aws/icons/aws/rds.svg
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
migrations: Migrations Lambda {
|
|
20
|
-
shape: image
|
|
21
|
-
icon: /nx-plugin-for-aws/icons/aws/lambda.svg
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
aurora: Aurora\n(PostgreSQL or MySQL) {
|
|
25
|
-
shape: image
|
|
26
|
-
icon: /nx-plugin-for-aws/icons/aws/aurora.svg
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
secrets: Secrets Manager\n(DB credentials) {
|
|
30
|
-
shape: image
|
|
31
|
-
icon: /nx-plugin-for-aws/icons/aws/secrets-manager.svg
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
app -> proxy: SQL (IAM auth)
|
|
35
|
-
proxy -> aurora
|
|
36
|
-
migrations -> aurora: Schema migrations
|
|
37
|
-
migrations -> secrets: Admin credentials
|
|
38
|
-
aurora -> secrets: Generates and rotates\nadmin credentials
|
|
39
|
-
```
|
|
8
|
+
<ArchitectureDiagram />
|
package/generators.json
CHANGED
|
@@ -104,6 +104,13 @@
|
|
|
104
104
|
"metric": "g15",
|
|
105
105
|
"hidden": true
|
|
106
106
|
},
|
|
107
|
+
"open-api#py-client": {
|
|
108
|
+
"factory": "./src/open-api/py-client/generator",
|
|
109
|
+
"schema": "./src/open-api/py-client/schema.json",
|
|
110
|
+
"description": "Generate a Python httpx client from an OpenAPI specification",
|
|
111
|
+
"metric": "g73",
|
|
112
|
+
"hidden": true
|
|
113
|
+
},
|
|
107
114
|
"open-api#ts-client": {
|
|
108
115
|
"factory": "./src/open-api/ts-client/generator",
|
|
109
116
|
"schema": "./src/open-api/ts-client/schema.json",
|
package/package.json
CHANGED
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"auth": {
|
|
36
36
|
"type": "string",
|
|
37
37
|
"description": "The method used to authenticate inbound requests to your gateway. Only applicable when infra is set (ignored when infra is none).",
|
|
38
|
+
"x-when": { "infra": "agentcore" },
|
|
38
39
|
"enum": ["iam", "cognito"],
|
|
39
40
|
"default": "iam",
|
|
40
41
|
"x-prompt": "How would you like to authenticate inbound requests to your gateway?",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "OpenApiPyClient",
|
|
4
|
+
"title": "OpenAPI Python Client",
|
|
5
|
+
"description": "Generate a Python httpx client from an OpenAPI specification",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"openApiSpecPath": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "Path to the OpenAPI specification relative to the monorepo root",
|
|
11
|
+
"x-priority": "important"
|
|
12
|
+
},
|
|
13
|
+
"outputPath": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "Path to the directory in which to generate the client relative to the monorepo root",
|
|
16
|
+
"x-priority": "important"
|
|
17
|
+
},
|
|
18
|
+
"clientType": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "Which clients to emit. 'sync' emits client.py using httpx.Client, 'async' emits async_client.py using httpx.AsyncClient, 'both' emits both.",
|
|
21
|
+
"enum": ["sync", "async", "both"],
|
|
22
|
+
"x-prompt": "Which clients would you like to emit?",
|
|
23
|
+
"default": "both",
|
|
24
|
+
"x-priority": "important"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"required": ["openApiSpecPath", "outputPath"]
|
|
28
|
+
}
|
package/src/py/agent/schema.json
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"auth": {
|
|
33
33
|
"type": "string",
|
|
34
34
|
"description": "The method used to authenticate with your Agent. Only applicable when infra is set (ignored when infra is none).",
|
|
35
|
+
"x-when": { "infra": ["agentcore", "agentcore-ecr"] },
|
|
35
36
|
"default": "iam",
|
|
36
37
|
"enum": ["iam", "cognito"],
|
|
37
38
|
"x-prompt": "How would you like to authenticate with your Agent?",
|
|
@@ -66,6 +67,7 @@
|
|
|
66
67
|
"description": "The storage used to persist session for your Agent. LangChain supports 's3' or 'dynamodb-s3'; Strands supports 's3'; 'in-memory' is valid for both.",
|
|
67
68
|
"x-prompt": "How would you like to persist session for your Agent?",
|
|
68
69
|
"enum": ["s3", "dynamodb-s3", "in-memory"],
|
|
70
|
+
"x-value-when": { "dynamodb-s3": { "framework": "langchain" } },
|
|
69
71
|
"default": "s3",
|
|
70
72
|
"x-priority": "important"
|
|
71
73
|
},
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"auth": {
|
|
25
25
|
"type": "string",
|
|
26
26
|
"description": "The method used to authenticate with your MCP server. Only applicable when infra is set (ignored when infra is none).",
|
|
27
|
+
"x-when": { "infra": ["agentcore", "agentcore-ecr"] },
|
|
27
28
|
"default": "iam",
|
|
28
29
|
"enum": ["iam", "cognito"],
|
|
29
30
|
"x-prompt": "How would you like to authenticate with your MCP server?",
|
package/src/ts/agent/schema.json
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"auth": {
|
|
33
33
|
"type": "string",
|
|
34
34
|
"description": "The method used to authenticate with your Agent. Only applicable when infra is set (ignored when infra is none).",
|
|
35
|
+
"x-when": { "infra": ["agentcore", "agentcore-ecr"] },
|
|
35
36
|
"default": "iam",
|
|
36
37
|
"enum": ["iam", "cognito"],
|
|
37
38
|
"x-prompt": "How would you like to authenticate with your Agent?",
|
package/src/ts/api/schema.json
CHANGED
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"namespace": {
|
|
40
40
|
"type": "string",
|
|
41
41
|
"description": "The namespace for the Smithy API (only applicable for the smithy framework). Defaults to your monorepo scope",
|
|
42
|
+
"x-when": { "framework": "smithy" },
|
|
42
43
|
"x-prompt": "What namespace would you like your API to have? i.e: com.example"
|
|
43
44
|
},
|
|
44
45
|
"integrationPattern": {
|
|
@@ -97,6 +98,7 @@
|
|
|
97
98
|
"description": "The type of infrastructure to use to deploy this API.",
|
|
98
99
|
"default": "rest-lambda",
|
|
99
100
|
"enum": ["rest-lambda", "http-lambda", "none"],
|
|
101
|
+
"x-value-when": { "http-lambda": { "framework": "trpc" } },
|
|
100
102
|
"x-prompt": "What infrastructure would you like to deploy your API with?",
|
|
101
103
|
"x-priority": "important"
|
|
102
104
|
},
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"auth": {
|
|
25
25
|
"type": "string",
|
|
26
26
|
"description": "The method used to authenticate with your MCP server. Only applicable when infra is set (ignored when infra is none).",
|
|
27
|
+
"x-when": { "infra": ["agentcore", "agentcore-ecr"] },
|
|
27
28
|
"default": "iam",
|
|
28
29
|
"enum": ["iam", "cognito"],
|
|
29
30
|
"x-prompt": "How would you like to authenticate with your MCP server?",
|