npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@pulumi/aws-static-website

v0.4.0

Published

This component makes it easy to deploy a static website to s3 along with an optional CloudFront distribution using any of the supported Pulumi programming languages including markup languages like YAML and JSON.

Downloads

1,177

Readme

Pulumi AWS Static Website Component

This component makes it easy to deploy a static website to s3 along with an optional CloudFront distribution using any of the supported Pulumi programming languages including markup languages like YAML and JSON.

Example Usage

Simple (only s3 bucket)

TypeScript:

const site = new staticwebsite.Website("website", {sitePath: "../website/build"});

export const url = site.websiteURL;

YAML:

resources:
  web:
    type: "aws-static-website:index:Website"
    properties:
      sitePath: "../website/build"
outputs:
  websiteURL: ${web.websiteURL}

With CloudFront CDN

TypeScript:

const site = new staticwebsite.Website("website", {
    withCDN: true,
    sitePath: "../website/build",
    targetDomain: "my-awesome-site.com",
    withLogs: true,
    cacheTTL: 600,
});

export const url = site.websiteURL;

YAML:

resources:
  web:
    type: "aws-static-website:index:Website"
    properties:
      withCDN: true
      sitePath: "../website/build"
      targetDomain: "my-awesome-site.com"
      withLogs: true
      cacheTTL: 600
outputs:
  websiteURL: ${web.websiteURL}

See the examples directory for fully working examples of how to consume this component.

Installation

If you are new to Pulumi and do not yet have our Pulumi installed, see our getting started guide to get up and running.

Install the SDK package corresponding to the language or runtime you are using. If using YAML or one of our other markup languages, this step can be skipped.

NodeJS

npm install @pulumi/aws-static-website

Python

pip3 install pulumi_aws_static_website

Go

go get -t github.com/pulumi/pulumi-aws-static-website/sdk/go/aws-static-website

This package can then be consumed just like any other package by importing it into your project (e.g. import * as website from '@pulumi/aws-static-website')

Input Properties

This component takes the following inputs.

  • sitePath (string) - the root directory containing the website's contents to be served (required)
  • withCDN (boolean) - provision a CloudFront CDN to serve content
  • targetDomain (string) - the domain used to serve the content. A Route53 hosted zone must exist for this domain is this option is specified
  • index.html (string) - the default document for the site. Defaults to index.html
  • error404 (string) - the default 404 error page
  • certificateARN (string) - the ARN of the ACM certificate to use for serving HTTPS. If one is not provided, a certificate will be created during the provisioning process
  • cacheTTL (number) - TTL in seconds for cached objects
  • withLogs (boolean) - provision a bucket to house access logs
  • priceClass (string) - The price class to use for the CloudFront configuration. Defaults to 100 if not specified. Valid values are all, 100, and 200"

Outputs

  • bucketName - the name of the s3 bucket containing the website's contents
  • bucketWebsiteURL - the website URL for the s3 bucket
  • cdnDomainName - the CDN domain name
  • cdnURL - the CDN's endpoint URL
  • logsBucketName - the name of the s3 bucket containing the access logs
  • websiteURL - the URL to access the website

Notes:

  • If specifying a target domain and provisioning a CloudFront distribution, it is assumed there is a hosted zone configured in route53 for that target domain.
  • If you already have an ACM certificate provisioned for your domain, then you can simply pass the ARN as one of the input properties. If not we will attempt to provision one for you based on the target domain provided.