# 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:
```typescript
const site = new staticwebsite.Website("website", {sitePath: "../website/build"});
export const url = site.websiteURL;
```
YAML:
```yaml
resources:
web:
type: "aws-static-website:index:Website"
properties:
sitePath: "../website/build"
outputs:
websiteURL: ${web.websiteURL}
```
### With CloudFront CDN
TypeScript:
```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:
```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](https://www.pulumi.com/docs/get-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](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PriceClass.html) 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.
Raw data
{
"_id": null,
"home_page": "https://pulumi.com",
"name": "pulumi-aws-static-website",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "pulumi aws category/cloud kind/component web",
"author": "",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/19/c6/d298e0846c81771d548c1f456a340f6eb69123d70537fa3543c7ff3e22d3/pulumi_aws_static_website-0.3.0.tar.gz",
"platform": null,
"description": "# Pulumi AWS Static Website Component\n\nThis 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.\n\n## Example Usage\n\n### Simple (only s3 bucket)\n\nTypeScript:\n```typescript\nconst site = new staticwebsite.Website(\"website\", {sitePath: \"../website/build\"});\n\nexport const url = site.websiteURL;\n```\n\nYAML:\n```yaml\nresources:\n web:\n type: \"aws-static-website:index:Website\"\n properties:\n sitePath: \"../website/build\"\noutputs:\n websiteURL: ${web.websiteURL}\n```\n\n### With CloudFront CDN\n\nTypeScript:\n```typescript\nconst site = new staticwebsite.Website(\"website\", {\n withCDN: true,\n sitePath: \"../website/build\",\n targetDomain: \"my-awesome-site.com\",\n withLogs: true,\n cacheTTL: 600,\n});\n\nexport const url = site.websiteURL;\n```\n\nYAML:\n```yaml\nresources:\n web:\n type: \"aws-static-website:index:Website\"\n properties:\n withCDN: true\n sitePath: \"../website/build\"\n targetDomain: \"my-awesome-site.com\"\n withLogs: true\n cacheTTL: 600\noutputs:\n websiteURL: ${web.websiteURL}\n```\nSee the examples directory for fully working examples of how to consume this component.\n\n## Installation\n\nIf you are new to Pulumi and do not yet have our Pulumi installed, see our [getting started](https://www.pulumi.com/docs/get-started/) guide to get up and running.\n\nInstall 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.\n\n### NodeJS\n\n```\nnpm install @pulumi/aws-static-website\n```\n\n### Python\n\n```\npip3 install pulumi_aws_static_website\n```\n\n### Go\n\n```\ngo get -t github.com/pulumi/pulumi-aws-static-website/sdk/go/aws-static-website\n```\n\nThis 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'`)\n\n## Input Properties\n\nThis component takes the following inputs.\n\n- sitePath (string) - the root directory containing the website's contents to be served (required)\n- withCDN (boolean) - provision a CloudFront CDN to serve content\n- targetDomain (string) - the domain used to serve the content. A Route53 hosted zone must exist for this domain is this option is specified\n- index.html (string) - the default document for the site. Defaults to index.html\n- error404 (string) - the default 404 error page\n- 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\n- cacheTTL (number) - TTL in seconds for cached objects\n- withLogs (boolean) - provision a bucket to house access logs\n- priceClass (string) - The [price class](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PriceClass.html) to use for the CloudFront configuration. Defaults to 100 if not specified. Valid values are `all`, `100`, and `200`\"\n\n## Outputs\n\n- bucketName - the name of the s3 bucket containing the website's contents\n- bucketWebsiteURL - the website URL for the s3 bucket\n- cdnDomainName - the CDN domain name\n- cdnURL - the CDN's endpoint URL\n- logsBucketName - the name of the s3 bucket containing the access logs\n- websiteURL - the URL to access the website\n\n\n## Notes:\n\n- 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.\n- 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.\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "A Pulumi component to deploy a static website to AWS",
"version": "0.3.0",
"split_keywords": [
"pulumi",
"aws",
"category/cloud",
"kind/component",
"web"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "19c6d298e0846c81771d548c1f456a340f6eb69123d70537fa3543c7ff3e22d3",
"md5": "565c4ef776d61cb72b407af4a3c4be0b",
"sha256": "f96a0827fd0277e2035fddf0562de556277262cdf04d8f59d30cac3d1041dd17"
},
"downloads": -1,
"filename": "pulumi_aws_static_website-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "565c4ef776d61cb72b407af4a3c4be0b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10610,
"upload_time": "2023-01-26T21:32:30",
"upload_time_iso_8601": "2023-01-26T21:32:30.338715Z",
"url": "https://files.pythonhosted.org/packages/19/c6/d298e0846c81771d548c1f456a340f6eb69123d70537fa3543c7ff3e22d3/pulumi_aws_static_website-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-26 21:32:30",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "pulumi-aws-static-website"
}