Package: pulumi-aws-static-website
Pulumi AWS Static Website ComponentThis 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 UsageSimple (only s3 bucket)TypeScript:constsite=newstaticwebsite.Website("website",{sitePath:"../website/build"});exportconsturl=site.websiteURL;YAML:resources:web:type:"aws-static-website:index:Website"properties:sitePath:"../website/build"outputs:websiteURL:${web.websiteURL}With CloudFront CDNTypeScript:constsite=newstaticwebsite.Website("website",{withCDN:true,sitePath:"../website/build",targetDomain:"my-awesome-site.com",withLogs:true,cacheTTL:600,});exportconsturl=site.websiteURL;YAML:resources:web:type:"aws-static-website:index:Website"properties:withCDN:truesitePath:"../website/build"targetDomain:"my-awesome-site.com"withLogs:truecacheTTL:600outputs:websiteURL:${web.websiteURL}See the examples directory for fully working examples of how to consume this component.InstallationIf you are new to Pulumi and do not yet have our Pulumi installed, see ourgetting startedguide 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.NodeJSnpm install @pulumi/aws-static-websitePythonpip3 install pulumi_aws_static_websiteGogo get -t github.com/pulumi/pulumi-aws-static-website/sdk/go/aws-static-websiteThis 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 PropertiesThis 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 contenttargetDomain (string) - the domain used to serve the content. A Route53 hosted zone must exist for this domain is this option is specifiedindex.html (string) - the default document for the site. Defaults to index.htmlerror404 (string) - the default 404 error pagecertificateARN (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 processcacheTTL (number) - TTL in seconds for cached objectswithLogs (boolean) - provision a bucket to house access logspriceClass (string) - Theprice classto use for the CloudFront configuration. Defaults to 100 if not specified. Valid values areall,100, and200"OutputsbucketName - the name of the s3 bucket containing the website's contentsbucketWebsiteURL - the website URL for the s3 bucketcdnDomainName - the CDN domain namecdnURL - the CDN's endpoint URLlogsBucketName - the name of the s3 bucket containing the access logswebsiteURL - the URL to access the websiteNotes: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.