@aws/nx-plugin-mcp 1.0.4 → 1.0.5
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 +241 -5219
- package/docs/guides/fastapi.mdx +6 -2
- package/docs/guides/trpc.mdx +6 -2
- package/docs/guides/ts-smithy-api.mdx +6 -2
- package/docs/snippets/api/custom-domain.mdx +80 -0
- package/package.json +1 -1
package/docs/guides/fastapi.mdx
CHANGED
|
@@ -571,9 +571,9 @@ You can set up Cognito User Pool and Client using the appropriate Terraform reso
|
|
|
571
571
|
The Terraform module provides several outputs you can use:
|
|
572
572
|
|
|
573
573
|
```hcl
|
|
574
|
-
# Access the API endpoint
|
|
574
|
+
# Access the API endpoint (the custom domain URL, if one is configured)
|
|
575
575
|
output "api_url" {
|
|
576
|
-
value = module.my_api.
|
|
576
|
+
value = module.my_api.api_url
|
|
577
577
|
}
|
|
578
578
|
|
|
579
579
|
# Access Lambda function details
|
|
@@ -630,6 +630,10 @@ Authorizer results are cached for 5 minutes, keyed on the `Authorization` header
|
|
|
630
630
|
<Snippet name="api/access-logging" parentHeading="Access logging" />
|
|
631
631
|
</OptionFilter>
|
|
632
632
|
|
|
633
|
+
### Custom domain
|
|
634
|
+
|
|
635
|
+
<Snippet name="api/custom-domain" parentHeading="Custom domain" />
|
|
636
|
+
|
|
633
637
|
### Integrations
|
|
634
638
|
|
|
635
639
|
<Snippet name="api/type-safe-api-integrations" parentHeading="Integrations" />
|
package/docs/guides/trpc.mdx
CHANGED
|
@@ -764,9 +764,9 @@ This sets up:
|
|
|
764
764
|
The Terraform module provides several outputs you can use:
|
|
765
765
|
|
|
766
766
|
```hcl
|
|
767
|
-
# Access the API endpoint
|
|
767
|
+
# Access the API endpoint (the custom domain URL, if one is configured)
|
|
768
768
|
output "api_url" {
|
|
769
|
-
value = module.my_api.
|
|
769
|
+
value = module.my_api.api_url
|
|
770
770
|
}
|
|
771
771
|
|
|
772
772
|
# Access Lambda function details
|
|
@@ -823,6 +823,10 @@ Authorizer results are cached for 5 minutes, keyed on the `Authorization` header
|
|
|
823
823
|
<Snippet name="api/access-logging" parentHeading="Access logging" />
|
|
824
824
|
</OptionFilter>
|
|
825
825
|
|
|
826
|
+
### Custom domain
|
|
827
|
+
|
|
828
|
+
<Snippet name="api/custom-domain" parentHeading="Custom domain" />
|
|
829
|
+
|
|
826
830
|
### Integrations
|
|
827
831
|
|
|
828
832
|
<Snippet name="api/type-safe-api-integrations" parentHeading="Integrations" />
|
|
@@ -765,9 +765,9 @@ Authorizer results are cached for 5 minutes, keyed on the `Authorization` header
|
|
|
765
765
|
The Terraform module provides several outputs:
|
|
766
766
|
|
|
767
767
|
```hcl
|
|
768
|
-
# Access the API endpoint
|
|
768
|
+
# Access the API endpoint (the custom domain URL, if one is configured)
|
|
769
769
|
output "api_url" {
|
|
770
|
-
value = module.my_api.
|
|
770
|
+
value = module.my_api.api_url
|
|
771
771
|
}
|
|
772
772
|
|
|
773
773
|
# Access Lambda function details
|
|
@@ -786,6 +786,10 @@ output "lambda_function_name" {
|
|
|
786
786
|
|
|
787
787
|
<Snippet name="api/access-logging" parentHeading="Access logging" />
|
|
788
788
|
|
|
789
|
+
### Custom domain
|
|
790
|
+
|
|
791
|
+
<Snippet name="api/custom-domain" parentHeading="Custom domain" />
|
|
792
|
+
|
|
789
793
|
### Integrations
|
|
790
794
|
|
|
791
795
|
<Infrastructure>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Custom domain
|
|
3
|
+
---
|
|
4
|
+
import Infrastructure from '@components/infrastructure.astro';
|
|
5
|
+
import Link from '@components/link.astro';
|
|
6
|
+
import OptionFilter from '@components/option-filter.astro';
|
|
7
|
+
|
|
8
|
+
By default your API is served from the endpoint API Gateway generates for it (`https://<id>.execute-api.<region>.amazonaws.com/...`). To serve it from your own domain instead, supply your domain name and an [ACM certificate](https://docs.aws.amazon.com/acm/latest/userguide/acm-overview.html) for it. The custom domain uses a regional endpoint by default, so the certificate must be in the same region as your API. A minimum TLS version of 1.2 is used by default.
|
|
9
|
+
|
|
10
|
+
When a custom domain is configured, the API's URL in <Link path="guides/runtime-config">Runtime Configuration</Link> is the custom domain URL, so your website and other clients call your domain rather than the generated endpoint.
|
|
11
|
+
|
|
12
|
+
<Infrastructure>
|
|
13
|
+
<Fragment slot="cdk">
|
|
14
|
+
Pass the domain through to `super` in the generated `packages/common/constructs/src/app/apis/my-api.ts`:
|
|
15
|
+
|
|
16
|
+
<OptionFilter when={{ infra: 'rest-lambda' }} description="Custom domain for a REST API in CDK">
|
|
17
|
+
```ts {1, 6-13} title="packages/common/constructs/src/app/apis/my-api.ts"
|
|
18
|
+
import { Certificate } from 'aws-cdk-lib/aws-certificatemanager';
|
|
19
|
+
|
|
20
|
+
super(scope, id, {
|
|
21
|
+
apiName: 'MyApi',
|
|
22
|
+
// ...
|
|
23
|
+
domainName: {
|
|
24
|
+
domainName: 'api.example.com',
|
|
25
|
+
certificate: Certificate.fromCertificateArn(
|
|
26
|
+
scope,
|
|
27
|
+
'MyApiCertificate',
|
|
28
|
+
'arn:aws:acm:<region>:123456789012:certificate/...',
|
|
29
|
+
),
|
|
30
|
+
},
|
|
31
|
+
...props,
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The API is served at the root of the domain, without the stage path prefix (`/prod/`). To serve it under a path instead, set `basePath` on `domainName`; the URL in runtime configuration includes it. `basePath` is only available in CDK; the Terraform module always serves the API at the root of the domain.
|
|
36
|
+
</OptionFilter>
|
|
37
|
+
|
|
38
|
+
<OptionFilter when={{ infra: 'http-lambda' }} description="Custom domain for an HTTP API in CDK">
|
|
39
|
+
```ts {1-2, 7-16} title="packages/common/constructs/src/app/apis/my-api.ts"
|
|
40
|
+
import { DomainName } from 'aws-cdk-lib/aws-apigatewayv2';
|
|
41
|
+
import { Certificate } from 'aws-cdk-lib/aws-certificatemanager';
|
|
42
|
+
|
|
43
|
+
super(scope, id, {
|
|
44
|
+
apiName: 'MyApi',
|
|
45
|
+
// ...
|
|
46
|
+
defaultDomainMapping: {
|
|
47
|
+
domainName: new DomainName(scope, 'MyApiDomainName', {
|
|
48
|
+
domainName: 'api.example.com',
|
|
49
|
+
certificate: Certificate.fromCertificateArn(
|
|
50
|
+
scope,
|
|
51
|
+
'MyApiCertificate',
|
|
52
|
+
'arn:aws:acm:<region>:123456789012:certificate/...',
|
|
53
|
+
),
|
|
54
|
+
}),
|
|
55
|
+
},
|
|
56
|
+
...props,
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
</OptionFilter>
|
|
60
|
+
|
|
61
|
+
When a custom domain is configured, the stack outputs `MyApiDomainNameAlias`, the domain name to point your DNS record at, and `MyApiDomainNameAliasHostedZoneId`.
|
|
62
|
+
</Fragment>
|
|
63
|
+
<Fragment slot="terraform">
|
|
64
|
+
Set the `custom_domain_name` and `acm_certificate_arn` variables on the API module:
|
|
65
|
+
|
|
66
|
+
```hcl {5-6} title="packages/infra/src/main.tf"
|
|
67
|
+
module "my_api" {
|
|
68
|
+
source = "../../common/terraform/src/app/apis/my-api"
|
|
69
|
+
# ...
|
|
70
|
+
|
|
71
|
+
custom_domain_name = "api.example.com"
|
|
72
|
+
acm_certificate_arn = "arn:aws:acm:<region>:123456789012:certificate/..."
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The module outputs `custom_domain_target_domain_name`, the regional domain name to point your DNS record at, and `custom_domain_hosted_zone_id`. Its `api_url` output is the URL clients should call: the custom domain URL when one is configured, otherwise the stage invoke URL.
|
|
77
|
+
</Fragment>
|
|
78
|
+
</Infrastructure>
|
|
79
|
+
|
|
80
|
+
Finally, create a DNS record for your domain. With any DNS provider, create a `CNAME` record pointing your domain at the domain name output above. If your domain is hosted in Route 53, you can create an alias record instead, using the hosted zone ID output, which also works at the zone apex (e.g. `example.com`).
|