0.4.0 • Published 2 years ago

@strongishllama/static-website-cdk v0.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Static Website CDK

NPN version License: MIT GitHub Workflow Status

Introduction

  • Common CDK constructs for static websites.
  • Build and deployment pipeline.
  • CloudFront distribution with a custom domain and HTTPS support.

Installation

npm install @strongishllama/static-website-cdk

Example

import * as codebuild from "aws-cdk-lib/aws-codebuild";
import * as route53 from "aws-cdk-lib/aws-route53";
import * as s3 from "aws-cdk-lib/aws-s3";
import * as cdk from "aws-cdk-lib/core";
import { Construct } from "constructs";
import { Deployment, Pipeline, PipelineProps } from "@strongishllama/static-website-cdk";

export class ExampleStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const bucket = new s3.Bucket(this, "bucket");

    const deployment = new Deployment(this, "deployment", {
      hostedZone: route53.HostedZone.fromLookup(this, "hosted-zone", {
        domainName: "example.com",
      }),
      domainName: "example.com",
      originBucket: bucket,
    });

    new Pipeline(this, "pipeline", {
      sourceOwner: "example-owner",
      sourceRepo: "example-repo",
      sourceBranch: "main",
      githubOAuthToken: cdk.SecretValue.plainText("example-secret-value"),
      buildEnvironmentVariables: {
        "example-key": {
          type: codebuild.BuildEnvironmentVariableType.PLAINTEXT,
          value: "example-value",
        },
      },
      approvalNotifyEmails: ["john@example.com"],
      deployBucket: bucket,
      distributionId: deployment.distribution.distributionId,
      account: "1234567890",
    });
  }
}
0.4.0

2 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.0

3 years ago

0.3.0-rc.1

3 years ago