Skip to main content

A Pulumi component to deploy a static website to AWS

Project description

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)


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

export const url = site.websiteURL;


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

With CloudFront CDN


const site = new staticwebsite.Website("website", {
    withCDN: true,
    sitePath: "../website/build",
    targetDomain: "",
    withLogs: true,
    cacheTTL: 600,

export const url = site.websiteURL;


    type: "aws-static-website:index:Website"
      withCDN: true
      sitePath: "../website/build"
      targetDomain: ""
      withLogs: true
      cacheTTL: 600
  websiteURL: ${web.websiteURL}

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


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.


npm install @pulumi/aws-static-website


pip3 install pulumi_aws_static_website


go get -t

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"


  • 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


  • 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.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pulumi_aws_static_website-0.1.1.tar.gz (9.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page