@aws/nx-plugin-mcp 0.119.0 → 0.121.0

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 (89) hide show
  1. package/bin/aws-nx-mcp.js +23 -35
  2. package/docs/guides/astro-docs.mdx +142 -0
  3. package/docs/guides/connection/py-agent-a2a.mdx +105 -0
  4. package/docs/guides/connection/py-agent-mcp.mdx +147 -0
  5. package/docs/guides/connection/react-agui.mdx +240 -0
  6. package/docs/guides/connection/react-fastapi.mdx +1476 -0
  7. package/docs/guides/connection/react-py-agent.mdx +198 -0
  8. package/docs/guides/connection/react-smithy.mdx +1355 -0
  9. package/docs/guides/connection/react-trpc.mdx +447 -0
  10. package/docs/guides/connection/react-ts-agent.mdx +198 -0
  11. package/docs/guides/connection/smithy-rdb.mdx +161 -0
  12. package/docs/guides/connection/trpc-rdb.mdx +127 -0
  13. package/docs/guides/connection/ts-agent-a2a.mdx +106 -0
  14. package/docs/guides/connection/ts-agent-mcp.mdx +144 -0
  15. package/docs/guides/connection/ts-agent-rdb.mdx +141 -0
  16. package/docs/guides/connection/ts-mcp-server-rdb.mdx +135 -0
  17. package/docs/guides/connection.mdx +126 -0
  18. package/docs/guides/docker-bundling.mdx +403 -0
  19. package/docs/guides/fastapi.mdx +509 -0
  20. package/docs/guides/license.mdx +293 -0
  21. package/docs/guides/nx-generator.mdx +588 -0
  22. package/docs/guides/py-agent.mdx +483 -0
  23. package/docs/guides/py-mcp-server.mdx +161 -0
  24. package/docs/guides/python-lambda-function.mdx +207 -0
  25. package/docs/guides/python-project.mdx +228 -0
  26. package/docs/guides/react-website-auth.mdx +216 -0
  27. package/docs/guides/react-website.mdx +421 -0
  28. package/docs/guides/runtime-config.mdx +312 -0
  29. package/docs/guides/terraform-project.mdx +317 -0
  30. package/docs/guides/trpc.mdx +816 -0
  31. package/docs/guides/ts-agent.mdx +436 -0
  32. package/docs/guides/ts-lambda-function.mdx +218 -0
  33. package/docs/guides/ts-mcp-server.mdx +169 -0
  34. package/docs/guides/ts-nx-plugin.mdx +159 -0
  35. package/docs/guides/ts-rdb.mdx +759 -0
  36. package/docs/guides/ts-smithy-api.mdx +661 -0
  37. package/docs/guides/typescript-infrastructure.mdx +408 -0
  38. package/docs/guides/typescript-project.mdx +312 -0
  39. package/docs/guides/workspace.mdx +181 -0
  40. package/docs/snippets/agent/architecture.mdx +72 -0
  41. package/docs/snippets/agent/bedrock-deployment.mdx +172 -0
  42. package/docs/snippets/agent/runtime-arn.mdx +64 -0
  43. package/docs/snippets/api/api-architecture.mdx +93 -0
  44. package/docs/snippets/api/api-choice-note.mdx +6 -0
  45. package/docs/snippets/api/cors-configuration-cdk-note.mdx +25 -0
  46. package/docs/snippets/api/cors-configuration-terraform-note.mdx +28 -0
  47. package/docs/snippets/api/shared-constructs.mdx +38 -0
  48. package/docs/snippets/api/type-safe-api-integrations.mdx +643 -0
  49. package/docs/snippets/api/waf-configuration.mdx +37 -0
  50. package/docs/snippets/connection/a2a-infrastructure.mdx +63 -0
  51. package/docs/snippets/connection/lambda-rdb-ssl-requirements.mdx +40 -0
  52. package/docs/snippets/connection/mcp-server-rdb-ssl-requirements.mdx +35 -0
  53. package/docs/snippets/connection/rdb-api-infrastructure.mdx +72 -0
  54. package/docs/snippets/connection/react-agent-infrastructure.mdx +61 -0
  55. package/docs/snippets/connection/strands-agent-rdb-ssl-requirements.mdx +35 -0
  56. package/docs/snippets/lambda-function/architecture.mdx +36 -0
  57. package/docs/snippets/lambda-function/deploying-your-function.mdx +118 -0
  58. package/docs/snippets/mcp/architecture.mdx +58 -0
  59. package/docs/snippets/mcp/assistant-docs.mdx +10 -0
  60. package/docs/snippets/mcp/bedrock-deployment.mdx +167 -0
  61. package/docs/snippets/mcp/config.mdx +13 -0
  62. package/docs/snippets/mcp/configuration-py.mdx +42 -0
  63. package/docs/snippets/mcp/configuration-ts.mdx +53 -0
  64. package/docs/snippets/mcp/observability.mdx +8 -0
  65. package/docs/snippets/mcp/shared-constructs.mdx +32 -0
  66. package/docs/snippets/pdk-migration/example/01-migrate-api.mdx +602 -0
  67. package/docs/snippets/pdk-migration/example/02-migrate-website.mdx +915 -0
  68. package/docs/snippets/pdk-migration/example/03-migrate-infra.mdx +161 -0
  69. package/docs/snippets/pdk-migration/example/04-deploy.mdx +229 -0
  70. package/docs/snippets/pdk-migration/faq/aws-arch.mdx +17 -0
  71. package/docs/snippets/pdk-migration/faq/cdk-graph.mdx +29 -0
  72. package/docs/snippets/pdk-migration/faq/infrastructure-python-java.mdx +19 -0
  73. package/docs/snippets/pdk-migration/faq/pdk-nag.mdx +15 -0
  74. package/docs/snippets/pdk-migration/faq/pipeline.mdx +15 -0
  75. package/docs/snippets/pdk-migration/faq/type-safe-api.mdx +310 -0
  76. package/docs/snippets/pdk-migration/faq/use-of-projen.mdx +15 -0
  77. package/docs/snippets/prerequisites.mdx +20 -0
  78. package/docs/snippets/required-prerequisites.mdx +12 -0
  79. package/docs/snippets/shared-constructs.mdx +40 -0
  80. package/docs/snippets/tools/acurl.mdx +73 -0
  81. package/docs/snippets/ts-bundle.mdx +14 -0
  82. package/package.json +1 -1
  83. package/src/py/agent/schema.json +1 -1
  84. package/src/py/fast-api/schema.json +2 -2
  85. package/src/py/mcp-server/schema.json +1 -1
  86. package/src/smithy/ts/api/schema.json +2 -2
  87. package/src/trpc/backend/schema.json +2 -2
  88. package/src/ts/agent/schema.json +1 -1
  89. package/src/ts/mcp-server/schema.json +1 -1
@@ -0,0 +1,161 @@
1
+ ---
2
+ title: Migrate the Infrastruture
3
+ ---
4
+ import { Steps, Tabs, TabItem } from '@astrojs/starlight/components';
5
+ import CreateNxWorkspaceCommand from '@components/create-nx-workspace-command.astro';
6
+ import RunGenerator from '@components/run-generator.astro';
7
+ import Link from '@components/link.astro';
8
+ import NxCommands from '@components/nx-commands.astro';
9
+ import Drawer from '@components/drawer.astro';
10
+ import InstallCommand from '@components/install-command.astro';
11
+
12
+ The last project we need to migrate for our shopping list application is the `InfrastructureTsProject`. This is a TypeScript CDK project, for which the Nx Plugin for AWS equivalent is the <Link path="/guides/typescript-infrastructure">`ts#infra` generator</Link>.
13
+
14
+ As well as the Projen projects, PDK also vended CDK constructs which these projects depend on. We will migrate the shopping list application from these CDK constructs too, in favour of the ones generated by the Nx Plugin for AWS.
15
+
16
+ :::tip
17
+ A big advantage of the Nx Plugin for AWS over PDK is that the CDK constructs it vends are source code added to your project rather than imported via a third party package. This gives you the control and flexibility to customise them beyond what PDK suppported.
18
+ :::
19
+
20
+ #### Generate a TypeScript CDK Infrastructure Project
21
+
22
+ Run the <Link path="/guides/typescript-infrastructure">`ts#infra` generator</Link> to set up your infrastructure project in `packages/infra`:
23
+
24
+ <RunGenerator generator="ts#infra" noInteractive requiredParameters={{ name: 'infra' }} />
25
+
26
+ #### Migrate the CDK Infrastructure
27
+
28
+ The PDK shopping list application instantiated the following constructs within the CDK application stack:
29
+
30
+ - `DatabaseConstruct` for the DynamoDB table storing shopping lists
31
+ - `UserIdentity` for Cognito resources, imported directly from PDK
32
+ - `MyApi` for deploying the Smithy API, which used the generated TypeScript CDK construct with type-safe integrations, depending on PDK's `TypeSafeRestApi` CDK construct under the hood.
33
+ - `Website` for deploying the Website, wrapping PDK's `StaticWebsite` CDK construct.
34
+
35
+ Next, we will migrate each of these to the new project.
36
+
37
+ ##### Copy the Application Stack
38
+
39
+ Copy `packages/infra/src/stacks/application-stack.ts` from the PDK shopping list application to the exact same location in your new project. You'll see some TypeScript errors which we'll address below.
40
+
41
+ ##### Copy the Database Construct
42
+
43
+ The PDK shopping list application had a `Database` construct in `packages/src/constructs/database.ts`. Copy this to the exact same location in your new project.
44
+
45
+ Since the Nx Plugin for AWS uses [Checkov](https://www.checkov.io/) for security tests which is a little stricter than PDK Nag, we also need to add some suppressions:
46
+
47
+ ```diff lang="ts"
48
+ // constructs/database.ts
49
+ +import { suppressRules } from ':shopping-list/common-constructs';
50
+ ...
51
+ +suppressRules(
52
+ + this.shoppingListTable,
53
+ + ['CKV_AWS_28', 'CKV_AWS_119'],
54
+ + 'Backup and KMS key not required for this project',
55
+ +);
56
+ ```
57
+
58
+ In `application-stack.ts`, update the import for the `DatabaseConstruct` to use ESM syntax:
59
+
60
+ ```diff lang="ts"
61
+ // stacks/application-stack.ts
62
+ -import { DatabaseConstruct } from '../constructs/database';
63
+ +import { DatabaseConstruct } from '../constructs/database.js';
64
+ ```
65
+
66
+ ##### Migrate the UserIdentity Construct
67
+
68
+ The `UserIdentity` construct can generally be swapped out without changes by adjusting the imports.
69
+
70
+ ```diff lang="ts"
71
+ -import { UserIdentity } from "@aws/pdk/identity";
72
+ +import { UserIdentity } from ':shopping-list/common-constructs';
73
+ ...
74
+ const userIdentity = new UserIdentity(this, `${id}UserIdentity`);
75
+ ```
76
+
77
+ Note that the underlying constructs used by the new `UserIdentity` construct are vended directly from `aws-cdk-lib`, where PDK used `@aws-cdk/aws-cognito-identitypool-alpha`.
78
+
79
+ ##### Migrate the API Construct
80
+
81
+ The PDK shopping list application had a construct in `constructs/apis/myapi.ts` which instantiated a CDK construct which Type Safe API generated from your Smithy model.
82
+
83
+ As well as this construct, since the PDK project used the `@handler` trait, generated lambda function CDK constructs were also generated.
84
+
85
+ Like Type Safe API, the Nx Plugin for AWS provides type-safety for integrations based on your Smithy model, however it's achieved in a much simpler and more flexible way. Instead of generating an entire CDK construct at build time, only minimal "metadata" is generated, which the `packages/common/constructs/src/app/apis/api.ts` uses in a generic fashion. You can learn more about how to use the construct in the <Link path="/guides/ts-smithy-api">`ts#smithy-api` generator guide</Link>.
86
+
87
+ Follow the below steps:
88
+
89
+ <Steps>
90
+
91
+ 1. Instantiate the `Api` construct in `application-stack.ts`
92
+
93
+ ```diff lang="ts"
94
+ // stacks/application-stack.ts
95
+ -import { MyApi } from "../constructs/apis/myapi";
96
+ +import { Api } from ':shopping-list/common-constructs';
97
+ ...
98
+ -const myapi = new MyApi(this, "MyApi", {
99
+ - databaseConstruct,
100
+ - userIdentity,
101
+ -});
102
+ +const api = new Api(this, 'MyApi', {
103
+ + integrations: Api.defaultIntegrations(this).build(),
104
+ +});
105
+ ```
106
+
107
+ Notice here we use `Api.defaultIntegrations(this).build()` - the default behaviour is to create a lambda function for each operation in our API, which is the same behaviour we had in `myapi.ts`.
108
+
109
+ 1. Grant permissions for the lambda functions to access the DynamoDB table.
110
+
111
+ In the PDK shopping list application, the `DatabaseConsruct` was passed into `MyApi`, and it managed adding the relevant permissions to each generated function construct. We'll do this directly in the `application-stack.ts` file by accessing the `Api` construct's type-safe `integrations` property:
112
+
113
+ ```ts
114
+ // stacks/application-stack.ts
115
+ // Grant our lambda functions scoped access to call Dynamo
116
+ databaseConstruct.shoppingListTable.grantReadData(
117
+ api.integrations.getShoppingLists.handler,
118
+ );
119
+ [
120
+ api.integrations.putShoppingList.handler,
121
+ api.integrations.deleteShoppingList.handler,
122
+ ].forEach((f) => databaseConstruct.shoppingListTable.grantWriteData(f));
123
+ ```
124
+
125
+ 1. Grant permissions for authenticated users to invoke the API.
126
+
127
+ Within the PDK application's `myapi.ts`, authenticated users were also granted IAM permissions to invoke the API. We will do the equivalent in `application-stack.ts`:
128
+
129
+ ```ts
130
+ // stacks/application-stack.ts
131
+ api.grantInvokeAccess(userIdentity.identityPool.authenticatedRole);
132
+ ```
133
+
134
+ </Steps>
135
+
136
+ ##### Migrate the Website Construct
137
+
138
+ Finally, we add the `Website` construct from `packages/common/constructs/src/app/static-websites/website.ts` to `application-stack.ts`, since this is the equivalent of the PDK shopping list application's `packages/infra/src/constructs/websites/website.ts`.
139
+
140
+ ```diff lang="ts"
141
+ -import { Website } from "../constructs/websites/website";
142
+ +import { Website } from ':shopping-list/common-constructs';
143
+ ...
144
+ -new Website(this, "Website", {
145
+ - userIdentity,
146
+ - myapi,
147
+ -});
148
+ +new Website(this, 'Website');
149
+ ```
150
+
151
+ Notice that we don't pass the identity or API to the website - runtime config is managed within each construct vended by the Nx Plugin for AWS, where `UserIdentity` and `Api` register the necessary values, and `Website` manages deploying it to `/runtime-config.json` on your static website.
152
+
153
+ Let's build the project now that we've migrated all the relevant parts of the codebase to our new project.
154
+
155
+ <NxCommands commands={["run-many --target build"]} />
156
+
157
+ :::caution
158
+ You may see a build failure due to lint issues. These can usually be automatically fixed:
159
+
160
+ <NxCommands commands={["run-many --target lint --fix"]} />
161
+ :::
@@ -0,0 +1,229 @@
1
+ ---
2
+ title: Deploy
3
+ ---
4
+ import { Steps, Tabs, TabItem } from '@astrojs/starlight/components';
5
+ import CreateNxWorkspaceCommand from '@components/create-nx-workspace-command.astro';
6
+ import RunGenerator from '@components/run-generator.astro';
7
+ import Link from '@components/link.astro';
8
+ import NxCommands from '@components/nx-commands.astro';
9
+ import Drawer from '@components/drawer.astro';
10
+ import InstallCommand from '@components/install-command.astro';
11
+
12
+
13
+ Now we've got our fully migrated codebase, we can look at deploying it. There are two paths we can take at this point.
14
+
15
+ #### All-New Resources (Simple)
16
+
17
+ The simplest approach is to treat this as a completely new application, meaning we'll "start again" with a fresh DynamoDB table and Cognito User Pool - losing all users and their shopping lists. For this approach, simply:
18
+
19
+ <Steps>
20
+
21
+ 1. Delete the DynamoDB table named `shopping_list`
22
+
23
+ 1. Deploy the new application:
24
+
25
+ <NxCommands commands={["deploy infra shopping-list-infra-sandbox/*"]} />
26
+
27
+ </Steps>
28
+
29
+ 🎉 And we're done! 🎉
30
+
31
+ #### Migrate Existing Stateful Resources with no Outage (More Complex)
32
+
33
+ In reality, it's more likely that you will want to migrate existing AWS resources so that they are managed by the new codebase, while avoiding any downtime for your customers.
34
+
35
+ :::danger
36
+ This approach is a bit more nuanced and complex, and this is just an example, so it's STRONGLY recommended to practice in a non-production environment (ideally create a new sandbox stack) and document the exact steps for your application. It is also recommended to write up contingency/rollback plans in case of steps failing or producing unexpected results.
37
+ :::
38
+
39
+ :::note
40
+ Our PDK shopping list application didn't define any custom domains or DNS. In practice you'd most likely have domains configured for your website and API. For the purpose of this section of the guide, we'll assume that we've set up Route53 with custom DNS names for the website and API.
41
+ :::
42
+
43
+ For our shopping list application, the stateful resources we care about are the DynamoDB table which contains our users' shopping lists, and the User Pool which contains the details of all of our registered users. Our high level plan will be to retain these two key resources and move them such that they're managed by our new stack, then to update DNS to point to our new website (and API if exposed to customers).
44
+
45
+ <Steps>
46
+
47
+ 1. Update your new application to reference the existing resources you wish to retain.
48
+
49
+ For the shopping list application, we do this for the DynamoDB table
50
+
51
+ ```diff lang="ts"
52
+ // constructs/database.ts
53
+ -this.shoppingListTable = new Table(this, 'ShoppingList', {
54
+ - ...
55
+ +this.shoppingListTable = Table.fromTableName(
56
+ + this,
57
+ + 'ShoppingList',
58
+ + 'shopping_list',
59
+ +);
60
+ ```
61
+
62
+ And for the Cognito User Pool
63
+
64
+ ```diff lang="ts"
65
+ // packages/common/constructs/src/core/user-identity.ts
66
+ -this.userPool = this.createUserPool();
67
+ +this.userPool = UserPool.fromUserPoolId(
68
+ + this,
69
+ + 'UserPool',
70
+ + '<your-user-pool-id>',
71
+ +);
72
+ ```
73
+
74
+ 1. Build and deploy the new application:
75
+
76
+ <NxCommands commands={["run-many --target build"]} />
77
+
78
+ <NxCommands commands={["deploy infra shopping-list-infra-sandbox/*"]} />
79
+
80
+ Now we have our new application stood up referencing the existing resources, not yet taking any traffic.
81
+
82
+ 1. Perform full integration testing to ensure the new application works as expected. For the shopping list application, load the website and check you can sign in and create, view, edit and delete shopping lists.
83
+
84
+ 1. Revert the changes which reference the existing resources in your new application, but do not deploy them yet.
85
+
86
+ ```diff lang="ts"
87
+ // constructs/database.ts
88
+ +this.shoppingListTable = new Table(this, 'ShoppingList', {
89
+ + ...
90
+ -this.shoppingListTable = Table.fromTableName(
91
+ - this,
92
+ - 'ShoppingList',
93
+ - 'shopping_list',
94
+ -);
95
+ ```
96
+
97
+ And for the Cognito User Pool
98
+
99
+ ```diff lang="ts"
100
+ // packages/common/constructs/src/core/user-identity.ts
101
+ +this.userPool = this.createUserPool();
102
+ -this.userPool = UserPool.fromUserPoolId(
103
+ - this,
104
+ - 'UserPool',
105
+ - '<your-user-pool-id>',
106
+ -);
107
+ ```
108
+
109
+ And then run a build
110
+
111
+ <NxCommands commands={["run-many --target build"]} />
112
+
113
+ 1. Use `cdk import` in your new application's `packages/infra` folder to see which resources we'll be prompted to import.
114
+
115
+ ```bash title="New Application"
116
+ cd packages/infra
117
+ pnpm exec cdk import shopping-list-infra-sandbox/Application --force
118
+ ```
119
+
120
+ Step through the prompts by hitting enter. The import will fail because the resources are managed by another stack - this is expected, we just did this step to confirm which resources we'll need to retain. You'll see output like this:
121
+
122
+ ```bash wrap
123
+ shopping-list-infra-sandbox/Application/ApplicationUserIdentity/UserPool/smsRole/Resource (AWS::IAM::Role): enter RoleName (empty to skip)
124
+ shopping-list-infra-sandbox/Application/ApplicationUserIdentity/UserPool/Resource (AWS::Cognito::UserPool): enter UserPoolId (empty to skip)
125
+ shopping-list-infra-sandbox/Application/Database/ShoppingList/Resource (AWS::DynamoDB::Table): import with TableName=shopping_list (y/n) y
126
+ ```
127
+
128
+ This tells us that there are actually 3 resources we'll need to import into our new stack.
129
+
130
+ 1. Update your old PDK project to set `RemovalPolicy` to `RETAIN` for the resources discovered from the previous step. At the time of writing this is the default for both the User Pool and the DynamoDB table, but we need to update it for the SMS Role we discovered above:
131
+
132
+ ```diff lang="ts"
133
+ // application-stack.ts
134
+ const userIdentity = new UserIdentity(this, `${id}UserIdentity`, {
135
+ userPool,
136
+ });
137
+
138
+ +const smsRole = userIdentity.userPool.node.findAll().filter(
139
+ + c => CfnResource.isCfnResource(c) &&
140
+ + c.node.path.includes('/smsRole/'))[0] as CfnResource;
141
+ +smsRole.applyRemovalPolicy(RemovalPolicy.RETAIN);
142
+ ```
143
+
144
+ 1. Deploy your PDK project so that the removal policies are applied
145
+
146
+ ```bash title="PDK Application"
147
+ cd packages/infra
148
+ npx projen deploy
149
+ ```
150
+
151
+ 1. Take a look at the CloudFormation console and record the values you were prompted for in the above `cdk import` step
152
+
153
+ 1. The User Pool ID, eg `us-west-2_XXXXX`
154
+ 2. The SMS Role Name, eg `infra-sandbox-UserIdentityUserPoolsmsRoleXXXXXX`
155
+
156
+ 1. Update your PDK project to reference the existing resources instead of creating them
157
+
158
+ ```diff lang="ts"
159
+ // constructs/database.ts
160
+ -this.shoppingListTable = new Table(this, 'ShoppingList', {
161
+ - ...
162
+ +this.shoppingListTable = Table.fromTableName(
163
+ + this,
164
+ + 'ShoppingList',
165
+ + 'shopping_list',
166
+ +);
167
+ ```
168
+
169
+ And for the Cognito User Pool
170
+
171
+ ```diff lang="ts"
172
+ // application-stack.ts
173
+ +const userPool = UserPool.fromUserPoolId(
174
+ + this,
175
+ + 'UserPool',
176
+ + '<your-user-pool-id>',
177
+ +);
178
+ const userIdentity = new UserIdentity(this, `${id}UserIdentity`, {
179
+ + // PDK construct accepts UserPool not IUserPool, but this still works!
180
+ + userPool: userPool as any,
181
+ });
182
+ ```
183
+
184
+ 1. Deploy your PDK project again, this will mean the resources are no longer managed by our PDK project's CloudFormation stack.
185
+
186
+ ```bash title="PDK Application"
187
+ cd packages/infra
188
+ npx projen deploy
189
+ ```
190
+
191
+ 1. Now that the resources are unmanaged, we can run `cdk import` in our new application to actually perform the import:
192
+
193
+ ```bash title="New Application"
194
+ cd packages/infra
195
+ pnpm exec cdk import shopping-list-infra-sandbox/Application --force
196
+ ```
197
+
198
+ Enter the values when prompted, the import should complete successfully.
199
+
200
+ 1. Deploy the new application again to make sure that any changes to these existing resources (now managed by your new stack) are made:
201
+
202
+ <NxCommands commands={["deploy infra shopping-list-infra-sandbox/*"]} />
203
+
204
+ 1. Perform a full test of your new application again
205
+
206
+ 1. Update DNS records to point to your new Website (and API if required).
207
+
208
+ We recommend a gradual approach using Route53 [Weighted Routing](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy-weighted.html), whereby a fraction of requests are directed to the new application to begin with. As you monitor your metrics you can increase the weight for the new application until no traffic is sent to your old PDK application.
209
+
210
+ If you don't have any DNS and used the auto-generated domains for the website and API, you can always look at proxying requests (eg via a [CloudFront HTTP origin](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront_origins-readme.html#from-an-http-endpoint) or [API Gateway HTTP integration(s)](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.HttpIntegration.html)).
211
+
212
+ 1. Monitor PDK application metrics to ensure there is no traffic, and finally destroy the old CloudFormation stack:
213
+
214
+ ```bash
215
+ cd packages/infra
216
+ npx projen destroy
217
+ ```
218
+
219
+ </Steps>
220
+
221
+ That was quite a bit more involved, but we successfully migrated our users seamlessly to the new application! 🎉🎉🎉
222
+
223
+ We now have the new benefits of the Nx Plugin for AWS over PDK:
224
+
225
+ - Faster builds
226
+ - Local API development support
227
+ - A vibe-coding friendly codebase (<Link path="/get_started/building-with-ai">try our MCP server!</Link>)
228
+ - More intuitive type-safe client/server code
229
+ - And more!
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: AWS Arch
3
+ ---
4
+ import { Steps, Tabs, TabItem } from '@astrojs/starlight/components';
5
+ import Snippet from '@components/snippet.astro';
6
+ import CreateNxWorkspaceCommand from '@components/create-nx-workspace-command.astro';
7
+ import RunGenerator from '@components/run-generator.astro';
8
+ import Link from '@components/link.astro';
9
+ import NxCommands from '@components/nx-commands.astro';
10
+ import Drawer from '@components/drawer.astro';
11
+ import InstallCommand from '@components/install-command.astro';
12
+
13
+ [AWS Arch](https://aws.github.io/aws-pdk/developer_guides/aws-arch/index.html) provided mappings between CloudFormation resources and their associated architecture icons for CDK Graph above.
14
+
15
+ Refer to the [AWS Architecture Icons page](https://aws.amazon.com/architecture/icons/) for icon related resources. [Diagrams](https://diagrams.mingrammer.com/) also provides a way to build diagrams as code.
16
+
17
+ If you were using this directly, consider forking the project and taking ownership!
@@ -0,0 +1,29 @@
1
+ ---
2
+ title: CDK Graph
3
+ ---
4
+ import { Steps, Tabs, TabItem } from '@astrojs/starlight/components';
5
+ import Snippet from '@components/snippet.astro';
6
+ import CreateNxWorkspaceCommand from '@components/create-nx-workspace-command.astro';
7
+ import RunGenerator from '@components/run-generator.astro';
8
+ import Link from '@components/link.astro';
9
+ import NxCommands from '@components/nx-commands.astro';
10
+ import Drawer from '@components/drawer.astro';
11
+ import InstallCommand from '@components/install-command.astro';
12
+
13
+ [CDK Graph](https://aws.github.io/aws-pdk/developer_guides/cdk-graph/index.html) builds graphs of your connected CDK resources, and provided two plugins:
14
+
15
+ #### Diagram Plugin
16
+
17
+ The [CDK Graph Diagram Plugin](https://aws.github.io/aws-pdk/developer_guides/cdk-graph-plugin-diagram/index.html) generates AWS architecture diagrams from your CDK infrastructure.
18
+
19
+ For a similar deterministic approach a viable alternative is [CDK-Dia](https://github.com/pistazie/cdk-dia).
20
+
21
+ With the advancements in Generative AI, many foundation models are capabile of creating high-quality diagrams from your CDK infrastructure. We recommend trying out the [AWS Diagram MCP Server](https://github.com/awslabs/mcp/tree/main/src/aws-diagram-mcp-server). Check out [this blog post](https://aws.amazon.com/blogs/machine-learning/build-aws-architecture-diagrams-using-amazon-q-cli-and-mcp/) for a walkthrough.
22
+
23
+ #### Threat Composer Plugin
24
+
25
+ The [CDK Graph Threat Composer Plugin](https://aws.github.io/aws-pdk/developer_guides/cdk-graph-plugin-threat-composer/index.html) generates a starter [Threat Composer](https://github.com/awslabs/threat-composer/) threat model from your CDK code.
26
+
27
+ This plugin worked by simply filtering a [base threat model](https://github.com/aws/aws-pdk/tree/mainline/packages/cdk-graph-plugin-threat-composer/src/model-generator/base-model) containing example threats, and filtering them based on the resources your stack made use of.
28
+
29
+ If you're interested in these specific example threats you can copy and filter the base threat model, or use it as context to help a foundation model generate a similar one.
@@ -0,0 +1,19 @@
1
+ ---
2
+ title: Infrastructure in Python or Java
3
+ ---
4
+ import { Steps, Tabs, TabItem } from '@astrojs/starlight/components';
5
+ import Snippet from '@components/snippet.astro';
6
+ import CreateNxWorkspaceCommand from '@components/create-nx-workspace-command.astro';
7
+ import RunGenerator from '@components/run-generator.astro';
8
+ import Link from '@components/link.astro';
9
+ import NxCommands from '@components/nx-commands.astro';
10
+ import Drawer from '@components/drawer.astro';
11
+ import InstallCommand from '@components/install-command.astro';
12
+
13
+ PDK supported CDK infrastructure written in Python and Java. We do not support this in the Nx Plugin for AWS at the time of writing.
14
+
15
+ The recommended path forward would be to either migrate your CDK infrastructure to TypeScript, or to use our generators and migrate the common constructs package to your desired language. You can use Generative AI to accelerate these kinds of migrations, for example [Kiro CLI](https://kiro.dev/cli/). You can have an AI agent iterate on the migration until the synthesized CloudFormation templates are identical.
16
+
17
+ The same applies for Type Safe API's generated infrastructure in Python or Java - you can translate the generic `rest-api.ts` construct from the common constructs package, and implement your own simple metadata generator for your target language (refer to the [APIs Modelled with OpenAPI](#apis-modelled-with-openapi) section).
18
+
19
+ You can use the <Link path="/guides/python-project">`py#project` generator</Link> for a base Python project to add your CDK code to (and move over your `cdk.json` file, adding relevant targets). You can use Nx's [`@nx/gradle`](https://nx.dev/technologies/java/introduction) plugin for Java projects, or [`@jnxplus/nx-maven`](https://github.com/gridatek/jnxplus/tree/main/packages/nx-maven) for Maven.
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: PDK Nag
3
+ ---
4
+ import { Steps, Tabs, TabItem } from '@astrojs/starlight/components';
5
+ import Snippet from '@components/snippet.astro';
6
+ import CreateNxWorkspaceCommand from '@components/create-nx-workspace-command.astro';
7
+ import RunGenerator from '@components/run-generator.astro';
8
+ import Link from '@components/link.astro';
9
+ import NxCommands from '@components/nx-commands.astro';
10
+ import Drawer from '@components/drawer.astro';
11
+ import InstallCommand from '@components/install-command.astro';
12
+
13
+ [PDK Nag](https://aws.github.io/aws-pdk/developer_guides/pdk-nag/index.html) wraps [CDK Nag](https://github.com/cdklabs/cdk-nag), and provides a set of [rules specific to building prototypes](https://github.com/aws/aws-pdk/blob/mainline/packages/pdk-nag/src/packs/aws-prototyping-rules.ts).
14
+
15
+ To migrate from PDK Nag, use CDK Nag directly. If you need the same set of rules you can create a "pack" of your own by following the [documentation here](https://github.com/cdklabs/cdk-nag/blob/main/docs/NagPack.md).
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: Pipeline
3
+ ---
4
+ import { Steps, Tabs, TabItem } from '@astrojs/starlight/components';
5
+ import Snippet from '@components/snippet.astro';
6
+ import CreateNxWorkspaceCommand from '@components/create-nx-workspace-command.astro';
7
+ import RunGenerator from '@components/run-generator.astro';
8
+ import Link from '@components/link.astro';
9
+ import NxCommands from '@components/nx-commands.astro';
10
+ import Drawer from '@components/drawer.astro';
11
+ import InstallCommand from '@components/install-command.astro';
12
+
13
+ PDK provided a [`PDKPipelineProject`](https://aws.github.io/aws-pdk/developer_guides/pipeline/index.html) which set up a CDK infrastructure project and made use of a CDK construct which wrapped some [CDK Pipelines](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.pipelines-readme.html) resources.
14
+
15
+ To migrate from this, you can use the CDK Pipelines constructs directly. In practice however it is likely more straightforward to use something like GitHub actions or GitLab CI/CD, where you define [CDK Stages](https://docs.aws.amazon.com/cdk/v2/guide/stages.html) and run the deploy command for the appropiate stage directly.