Skip to content

Static Website

To publish a static website for internal usage, the StaticWebsite construct can be used.

It guards the page with our internal Okta authentication, making sure only our employees could see the published page.

[!NOTE]
The StaticWebsite has to be created in the us-east-1 region!

Usage Example

This is a minimal example without Route53 integration.

import { StaticWebsite } from '@pit-shared/cdk/static-website'

declare const scope: import('aws-cdk-lib').Stack

const website = new StaticWebsite(scope, 'website', {
    sourceFolder: './pages',
})

// domain of the published page
website.distribution.domainName

API

/**
 * Name of the website. Used in several places to
 * name or describe AWS resources.
 *
 * @default Static Website
 */
name?: string
/**
 * The folder containing the website's source files.
 */
sourceFolder: string
/**
 * The name of the hosted zone for the website.
 */
hostedZoneName?: string
/**
 * The domain name for the website.
 */
domainName?: string
/**
 * The name of the index files for the website.
 * Set to an empty string to remove url-rewriting
 *
 * @default index.html
 */
indexFile?: string
/**
 * The log group for all AWS logs.
 */
logGroup?: logs.ILogGroup