From 3fab0f0a5fb7ef684db7bf3ec2988fb2691eb4a1 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Thu, 1 May 2025 15:37:22 +1000 Subject: [PATCH 1/2] add aws website documentation --- docs/providers/pulumi/aws.mdx | 50 ++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/docs/providers/pulumi/aws.mdx b/docs/providers/pulumi/aws.mdx index 606a027df..2350ee96e 100644 --- a/docs/providers/pulumi/aws.mdx +++ b/docs/providers/pulumi/aws.mdx @@ -96,8 +96,8 @@ The Nitric team is working to expand the list of resources that can be imported. - [Buckets](/storage) - Currently, only resources in the same AWS account and region as the Nitric project - are supported. + Currently, only resources in the same AWS account and region as the Nitric + project are supported. ### Buckets @@ -142,8 +142,8 @@ import: ``` - Unlike some other imported resources, secret imports require the ARN to be used. - Providing only the secret's name will be invalid. + Unlike some other imported resources, secret imports require the ARN to be + used. Providing only the secret's name will be invalid. Need to import another resource type or have another question? Chat with us on [Discord](https://nitric.io/chat) or [open an issue](https://github.com/nitrictech/nitric/issues) on GitHub. @@ -190,6 +190,13 @@ apis: - api.example.com description: An AWS API +# Apply configuration for nitric websites +cdn: + # A valid domain or subdomain for the CloudFront Distribution to use for the deployed websites endpoint + domain: cdn.example.com + # Skip CDN cache invalidation during deployments (defaults to false) + skip-cache-invalidation: true + # Configure your deployed services config: # How services without a type will be deployed @@ -228,6 +235,41 @@ config: provisioned-concurrency: 1 ``` +### Websites + +When deploying [websites](/websites), Nitric will create a CloudFront Distribution that automatically provides a public URL for your website. This URL is not suitable for production use, and you should configure a custom domain for your website. + +The Hosted Zone used to configure the custom domain must be created in Route53 before deploying your CloudFront distribution with a custom domain configuration. + +- Purchase/Register a domain name with your domain registrar of choice. +- Navigate to https://us-east-1.console.aws.amazon.com/route53/v2/hostedzones in your Azure Portal +- Click `Create hosted zone` +- Enter a `Domain name` of your choice, this should be the domain name you purchased i.e. example.com +- Select Public Hosted Zone +- Click `Create hosted zone` +- Once the Hosted Zone is created, click on the `Go to resource` button + +Now that the Hosted Zone is created, you need to configure your registrar (domain) or existing DNS (subdomain) to point at the new name servers created for the zone. + +The configuration details are available on the `Records` tab within the `Hosted Zone` page. This step is different depending on your chosen domain registrar. Below are some general steps depending on whether your configuring the primary domain or a subdomain. + +#### Domain + +Your registrar (e.g. Namecheap, GoDaddy, Cloudflare, etc.) will allow you to change the name servers for you domain, sometimes this is called 'Custom DNS'. Add each of the name servers (NS records) from the Registrar setup dialog in the relevant config page for your registrar. + +#### Subdomain + +If you're configuring a subdomain e.g. app.yourdomain.com, you can simply add the NS records to your existing DNS configuration for the chosen subdomain. Typically, the config will look something like this: + +Substitute your values for `Nameserver` + +| Record Type | Nameserver | +| ----------- | ----------------------- | +| NS Record | ns-001.awsdns-60.net. | +| NS Record | ns-002.awsdns-49.co.uk. | +| NS Record | ns-003.awsdns-24.org. | +| NS Record | ns-004.awsdns-34.com. | + Missing something? Let us know by raising an issue in [GitHub](https://github.com/nitrictech/nitric) or by dropping us a line on From 3f66aed979b64b69be690ba97e50e3475c1c65b5 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Wed, 7 May 2025 14:06:56 +1000 Subject: [PATCH 2/2] add terraform cdn configuration --- docs/providers/terraform/aws.mdx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/providers/terraform/aws.mdx b/docs/providers/terraform/aws.mdx index 57299a86a..c2caa1b77 100644 --- a/docs/providers/terraform/aws.mdx +++ b/docs/providers/terraform/aws.mdx @@ -112,6 +112,13 @@ apis: domains: - api.example.com +# Apply configuration for nitric websites +cdn: + # A valid domain or subdomain for the CloudFront Distribution to use for the deployed websites endpoint + domain: cdn.example.com + # Skip CDN cache invalidation during deployments (defaults to false) + skip-cache-invalidation: true + # Configure your deployed services config: # How services without a type will be deployed