# @creativepenguin/cdk-static-site

> This construct deploys a static site including:

Latest version **0.3.0** (published 2020-02-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @creativepenguin/cdk-static-site
pnpm add @creativepenguin/cdk-static-site
yarn add @creativepenguin/cdk-static-site
bun add @creativepenguin/cdk-static-site
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2020-02-21 |
| First published | 2020-02-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 18 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jim Jenkins |
| Maintainers | jimjenkins5 |

## Links

- npm: https://www.npmjs.com/package/@creativepenguin/cdk-static-site
- Repository: https://gihub.com/creative-penguin/cdk-static-site
- Homepage: https://github.com/creative-penguin/cdk-static-site#readme
- npm.io page: https://npm.io/package/@creativepenguin/cdk-static-site

## Dependencies (7)

- [@aws-cdk/core](https://npm.io/package/@aws-cdk/core.md) 1.25.0
- [@aws-cdk/aws-s3](https://npm.io/package/@aws-cdk/aws-s3.md) 1.25.0
- [@aws-cdk/aws-ssm](https://npm.io/package/@aws-cdk/aws-ssm.md) 1.25.0
- [@aws-cdk/aws-route53](https://npm.io/package/@aws-cdk/aws-route53.md) 1.25.0
- [@aws-cdk/aws-cloudfront](https://npm.io/package/@aws-cdk/aws-cloudfront.md) 1.25.0
- [@aws-cdk/aws-s3-deployment](https://npm.io/package/@aws-cdk/aws-s3-deployment.md) 1.25.0
- [@aws-cdk/aws-route53-targets](https://npm.io/package/@aws-cdk/aws-route53-targets.md) 1.25.0

## Recent versions

- 0.3.0 (latest) — 2020-02-21
- 0.2.0 — 2020-02-17

## README

# @creativepenguin/cdk-static-site

This construct deploys a static site including:

   * S3 Bucket
   * CloudFront Distribution
   * Route53 CNAME Records

## Usage

```typescript
import cdk = require('@aws-cdk/core');
import { StaticSite, StaticSiteProps } from '@creativepenguin/cdk-static-site';
const app = new cdk.App();

const staticSiteProps: StaticSiteProps = {
   env: { account: 'xxxxxxxxxxxxx', region: 'us-east-1' },
   domainName: 'example.com'
};

new StaticSite(app, 'unique-id', staticSiteProps);
```

## Options

### `domainName`

A custom domain alias for the CloudFront distribution

Supplying a custom domain name will trigger a lookup for the hosted zone in Route53 and a
certificate ARN value in SSM. Also CNAME records will be added to the Route53 hosted zone.

### `subdomains`

A list of subdomains to add CNAME records for. (Default: `[ 'www', '' ]`).

This value is ignored if no `domainName` is provided.

### `certificateARN`

An ARN for a certificate to associate with a custom domain alias in the CloudFront
distributions.

This value is ignored if no `domainName` is provided.

### `ssmCertificatePrefix`

A prefix for the SSM key used when looking up a certificate ARN. (Default: `/certificates/`)

This value is ignored if no `domainName` is provided.

### `siteDirectory`

Path to the static site directory, relative to the directory `cdk deploy` is run in. The
contents of this directory will be copied to the s3 bucket. (Defaults: `./dist`)

## Manual Setup Procedures

The following must be done before running a deploy. If using a custom domain.

### Route53 Hosted Zone

The corresponding hosted zone must be setup in Route53.

### Certificate

A certificate corresponding to the domain and subdomains specified should be created and validated.

If using providing the certificate ARN through a SSM parameter lookup, the parameter must exist. By default, this should be saved with the key `/certificates/{domainName}`.

---
_Source: https://npm.io/package/@creativepenguin/cdk-static-site · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
