1. Packages
  2. AWS Static Website
  3. API Docs
  4. Website
AWS Static Website v0.4.0 published on Wednesday, Apr 19, 2023 by Pulumi

aws-static-website.Website

Explore with Pulumi AI

Create Website Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Website(name: string, args: WebsiteArgs, opts?: ComponentResourceOptions);
@overload
def Website(resource_name: str,
            args: WebsiteArgs,
            opts: Optional[ResourceOptions] = None)

@overload
def Website(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            site_path: Optional[str] = None,
            index_html: Optional[str] = None,
            cache_ttl: Optional[float] = None,
            cdn_args: Optional[CDNArgsArgs] = None,
            certificate_arn: Optional[str] = None,
            error404: Optional[str] = None,
            add_website_version_header: Optional[bool] = None,
            price_class: Optional[str] = None,
            atomic_deployments: Optional[bool] = None,
            subdomain: Optional[str] = None,
            target_domain: Optional[str] = None,
            with_cdn: Optional[bool] = None,
            with_logs: Optional[bool] = None)
func NewWebsite(ctx *Context, name string, args WebsiteArgs, opts ...ResourceOption) (*Website, error)
public Website(string name, WebsiteArgs args, ComponentResourceOptions? opts = null)
public Website(String name, WebsiteArgs args)
public Website(String name, WebsiteArgs args, ComponentResourceOptions options)
type: aws-static-website:Website
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. WebsiteArgs
The arguments to resource properties.
opts ComponentResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. WebsiteArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. WebsiteArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. WebsiteArgs
The arguments to resource properties.
opts ComponentResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. WebsiteArgs
The arguments to resource properties.
options ComponentResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var websiteResource = new AwsStaticWebsite.Website("websiteResource", new()
{
    SitePath = "string",
    IndexHTML = "string",
    CacheTTL = 0,
    CdnArgs = new AwsStaticWebsite.Inputs.CDNArgsArgs
    {
        CloudfrontFunctionAssociations = new[]
        {
            new Aws.CloudFront.Inputs.DistributionOrderedCacheBehaviorFunctionAssociationArgs
            {
                EventType = "string",
                FunctionArn = "string",
            },
        },
        ForwardedValues = new Aws.CloudFront.Inputs.DistributionDefaultCacheBehaviorForwardedValuesArgs
        {
            Cookies = new Aws.CloudFront.Inputs.DistributionDefaultCacheBehaviorForwardedValuesCookiesArgs
            {
                Forward = "string",
                WhitelistedNames = new[]
                {
                    "string",
                },
            },
            QueryString = false,
            Headers = new[]
            {
                "string",
            },
            QueryStringCacheKeys = new[]
            {
                "string",
            },
        },
        LambdaFunctionAssociations = new[]
        {
            new Aws.CloudFront.Inputs.DistributionOrderedCacheBehaviorLambdaFunctionAssociationArgs
            {
                EventType = "string",
                LambdaArn = "string",
                IncludeBody = false,
            },
        },
    },
    CertificateARN = "string",
    Error404 = "string",
    AddWebsiteVersionHeader = false,
    PriceClass = "string",
    AtomicDeployments = false,
    Subdomain = "string",
    TargetDomain = "string",
    WithCDN = false,
    WithLogs = false,
});
Copy
example, err := awsstaticwebsite.NewWebsite(ctx, "websiteResource", &awsstaticwebsite.WebsiteArgs{
	SitePath:  pulumi.String("string"),
	IndexHTML: pulumi.String("string"),
	CacheTTL:  pulumi.Float64(0),
	CdnArgs: &awsstaticwebsite.CDNArgsArgs{
		CloudfrontFunctionAssociations: cloudfront.DistributionOrderedCacheBehaviorFunctionAssociationArray{
			&cloudfront.DistributionOrderedCacheBehaviorFunctionAssociationArgs{
				EventType:   pulumi.String("string"),
				FunctionArn: pulumi.String("string"),
			},
		},
		ForwardedValues: &cloudfront.DistributionDefaultCacheBehaviorForwardedValuesArgs{
			Cookies: &cloudfront.DistributionDefaultCacheBehaviorForwardedValuesCookiesArgs{
				Forward: pulumi.String("string"),
				WhitelistedNames: pulumi.StringArray{
					pulumi.String("string"),
				},
			},
			QueryString: pulumi.Bool(false),
			Headers: pulumi.StringArray{
				pulumi.String("string"),
			},
			QueryStringCacheKeys: pulumi.StringArray{
				pulumi.String("string"),
			},
		},
		LambdaFunctionAssociations: cloudfront.DistributionOrderedCacheBehaviorLambdaFunctionAssociationArray{
			&cloudfront.DistributionOrderedCacheBehaviorLambdaFunctionAssociationArgs{
				EventType:   pulumi.String("string"),
				LambdaArn:   pulumi.String("string"),
				IncludeBody: pulumi.Bool(false),
			},
		},
	},
	CertificateARN:          pulumi.String("string"),
	Error404:                pulumi.String("string"),
	AddWebsiteVersionHeader: pulumi.Bool(false),
	PriceClass:              pulumi.String("string"),
	AtomicDeployments:       pulumi.Bool(false),
	Subdomain:               pulumi.String("string"),
	TargetDomain:            pulumi.String("string"),
	WithCDN:                 pulumi.Bool(false),
	WithLogs:                pulumi.Bool(false),
})
Copy
var websiteResource = new Website("websiteResource", WebsiteArgs.builder()
    .sitePath("string")
    .indexHTML("string")
    .cacheTTL(0)
    .cdnArgs(CDNArgs.builder()
        .cloudfrontFunctionAssociations(DistributionOrderedCacheBehaviorFunctionAssociationArgs.builder()
            .eventType("string")
            .functionArn("string")
            .build())
        .forwardedValues(DistributionDefaultCacheBehaviorForwardedValuesArgs.builder()
            .cookies(DistributionDefaultCacheBehaviorForwardedValuesCookiesArgs.builder()
                .forward("string")
                .whitelistedNames("string")
                .build())
            .queryString(false)
            .headers("string")
            .queryStringCacheKeys("string")
            .build())
        .lambdaFunctionAssociations(DistributionOrderedCacheBehaviorLambdaFunctionAssociationArgs.builder()
            .eventType("string")
            .lambdaArn("string")
            .includeBody(false)
            .build())
        .build())
    .certificateARN("string")
    .error404("string")
    .addWebsiteVersionHeader(false)
    .priceClass("string")
    .atomicDeployments(false)
    .subdomain("string")
    .targetDomain("string")
    .withCDN(false)
    .withLogs(false)
    .build());
Copy
website_resource = aws_static_website.Website("websiteResource",
    site_path="string",
    index_html="string",
    cache_ttl=0,
    cdn_args={
        "cloudfront_function_associations": [{
            "event_type": "string",
            "function_arn": "string",
        }],
        "forwarded_values": {
            "cookies": {
                "forward": "string",
                "whitelisted_names": ["string"],
            },
            "query_string": False,
            "headers": ["string"],
            "query_string_cache_keys": ["string"],
        },
        "lambda_function_associations": [{
            "event_type": "string",
            "lambda_arn": "string",
            "include_body": False,
        }],
    },
    certificate_arn="string",
    error404="string",
    add_website_version_header=False,
    price_class="string",
    atomic_deployments=False,
    subdomain="string",
    target_domain="string",
    with_cdn=False,
    with_logs=False)
Copy
const websiteResource = new aws_static_website.Website("websiteResource", {
    sitePath: "string",
    indexHTML: "string",
    cacheTTL: 0,
    cdnArgs: {
        cloudfrontFunctionAssociations: [{
            eventType: "string",
            functionArn: "string",
        }],
        forwardedValues: {
            cookies: {
                forward: "string",
                whitelistedNames: ["string"],
            },
            queryString: false,
            headers: ["string"],
            queryStringCacheKeys: ["string"],
        },
        lambdaFunctionAssociations: [{
            eventType: "string",
            lambdaArn: "string",
            includeBody: false,
        }],
    },
    certificateARN: "string",
    error404: "string",
    addWebsiteVersionHeader: false,
    priceClass: "string",
    atomicDeployments: false,
    subdomain: "string",
    targetDomain: "string",
    withCDN: false,
    withLogs: false,
});
Copy
type: aws-static-website:Website
properties:
    addWebsiteVersionHeader: false
    atomicDeployments: false
    cacheTTL: 0
    cdnArgs:
        cloudfrontFunctionAssociations:
            - eventType: string
              functionArn: string
        forwardedValues:
            cookies:
                forward: string
                whitelistedNames:
                    - string
            headers:
                - string
            queryString: false
            queryStringCacheKeys:
                - string
        lambdaFunctionAssociations:
            - eventType: string
              includeBody: false
              lambdaArn: string
    certificateARN: string
    error404: string
    indexHTML: string
    priceClass: string
    sitePath: string
    subdomain: string
    targetDomain: string
    withCDN: false
    withLogs: false
Copy

Website Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Website resource accepts the following input properties:

SitePath This property is required. string
The root directory containing the website's contents.
AddWebsiteVersionHeader bool
Enable a cache control header to be attached to every request from an Cloudfront Function.
AtomicDeployments bool
Provision a new bucket on each deployment.
CacheTTL double
TTL in seconds for cached objects.
CdnArgs Pulumi.AwsStaticWebsite.Inputs.CDNArgs
Optional arguments used to configure the CDN.
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.
Error404 string
default 404 page
IndexHTML string
The default document for the site. Defaults to index.html
PriceClass string
The price class to use for the CloudFront configuration. Defaults to 100 if not specified. Valid values are all, 100, and 200
Subdomain string
An optional subdomain that can be used to serve the content. This can typically be used to provision a www alias or if a deeply nested subdomain is needed (e.g. foo.bar.baz.com).
TargetDomain string
The domain used to serve the content. A Route53 hosted zone must exist for this domain.
WithCDN bool
Provision CloudFront CDN to serve content.
WithLogs bool
Provision a bucket to hold access logs.
SitePath This property is required. string
The root directory containing the website's contents.
AddWebsiteVersionHeader bool
Enable a cache control header to be attached to every request from an Cloudfront Function.
AtomicDeployments bool
Provision a new bucket on each deployment.
CacheTTL float64
TTL in seconds for cached objects.
CdnArgs CDNArgsArgs
Optional arguments used to configure the CDN.
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.
Error404 string
default 404 page
IndexHTML string
The default document for the site. Defaults to index.html
PriceClass string
The price class to use for the CloudFront configuration. Defaults to 100 if not specified. Valid values are all, 100, and 200
Subdomain string
An optional subdomain that can be used to serve the content. This can typically be used to provision a www alias or if a deeply nested subdomain is needed (e.g. foo.bar.baz.com).
TargetDomain string
The domain used to serve the content. A Route53 hosted zone must exist for this domain.
WithCDN bool
Provision CloudFront CDN to serve content.
WithLogs bool
Provision a bucket to hold access logs.
sitePath This property is required. String
The root directory containing the website's contents.
addWebsiteVersionHeader Boolean
Enable a cache control header to be attached to every request from an Cloudfront Function.
atomicDeployments Boolean
Provision a new bucket on each deployment.
cacheTTL Double
TTL in seconds for cached objects.
cdnArgs CDNArgs
Optional arguments used to configure the CDN.
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.
error404 String
default 404 page
indexHTML String
The default document for the site. Defaults to index.html
priceClass String
The price class to use for the CloudFront configuration. Defaults to 100 if not specified. Valid values are all, 100, and 200
subdomain String
An optional subdomain that can be used to serve the content. This can typically be used to provision a www alias or if a deeply nested subdomain is needed (e.g. foo.bar.baz.com).
targetDomain String
The domain used to serve the content. A Route53 hosted zone must exist for this domain.
withCDN Boolean
Provision CloudFront CDN to serve content.
withLogs Boolean
Provision a bucket to hold access logs.
sitePath This property is required. string
The root directory containing the website's contents.
addWebsiteVersionHeader boolean
Enable a cache control header to be attached to every request from an Cloudfront Function.
atomicDeployments boolean
Provision a new bucket on each deployment.
cacheTTL number
TTL in seconds for cached objects.
cdnArgs CDNArgs
Optional arguments used to configure the CDN.
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.
error404 string
default 404 page
indexHTML string
The default document for the site. Defaults to index.html
priceClass string
The price class to use for the CloudFront configuration. Defaults to 100 if not specified. Valid values are all, 100, and 200
subdomain string
An optional subdomain that can be used to serve the content. This can typically be used to provision a www alias or if a deeply nested subdomain is needed (e.g. foo.bar.baz.com).
targetDomain string
The domain used to serve the content. A Route53 hosted zone must exist for this domain.
withCDN boolean
Provision CloudFront CDN to serve content.
withLogs boolean
Provision a bucket to hold access logs.
site_path This property is required. str
The root directory containing the website's contents.
add_website_version_header bool
Enable a cache control header to be attached to every request from an Cloudfront Function.
atomic_deployments bool
Provision a new bucket on each deployment.
cache_ttl float
TTL in seconds for cached objects.
cdn_args CDNArgsArgs
Optional arguments used to configure the CDN.
certificate_arn str
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.
error404 str
default 404 page
index_html str
The default document for the site. Defaults to index.html
price_class str
The price class to use for the CloudFront configuration. Defaults to 100 if not specified. Valid values are all, 100, and 200
subdomain str
An optional subdomain that can be used to serve the content. This can typically be used to provision a www alias or if a deeply nested subdomain is needed (e.g. foo.bar.baz.com).
target_domain str
The domain used to serve the content. A Route53 hosted zone must exist for this domain.
with_cdn bool
Provision CloudFront CDN to serve content.
with_logs bool
Provision a bucket to hold access logs.
sitePath This property is required. String
The root directory containing the website's contents.
addWebsiteVersionHeader Boolean
Enable a cache control header to be attached to every request from an Cloudfront Function.
atomicDeployments Boolean
Provision a new bucket on each deployment.
cacheTTL Number
TTL in seconds for cached objects.
cdnArgs Property Map
Optional arguments used to configure the CDN.
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.
error404 String
default 404 page
indexHTML String
The default document for the site. Defaults to index.html
priceClass String
The price class to use for the CloudFront configuration. Defaults to 100 if not specified. Valid values are all, 100, and 200
subdomain String
An optional subdomain that can be used to serve the content. This can typically be used to provision a www alias or if a deeply nested subdomain is needed (e.g. foo.bar.baz.com).
targetDomain String
The domain used to serve the content. A Route53 hosted zone must exist for this domain.
withCDN Boolean
Provision CloudFront CDN to serve content.
withLogs Boolean
Provision a bucket to hold access logs.

Outputs

All input properties are implicitly available as output properties. Additionally, the Website resource produces the following output properties:

BucketName string
The name of the s3 bucket containing the website contents.
BucketWebsiteURL string
The website URL for the s3 bucket.
WebsiteURL string
The URL to access the website
CdnDomainName string
The domain name for the CDN.
CdnURL string
The URL for the CDN
LogsBucketName string
The name of the s3 bucket containing the access logs.
BucketName string
The name of the s3 bucket containing the website contents.
BucketWebsiteURL string
The website URL for the s3 bucket.
WebsiteURL string
The URL to access the website
CdnDomainName string
The domain name for the CDN.
CdnURL string
The URL for the CDN
LogsBucketName string
The name of the s3 bucket containing the access logs.
bucketName String
The name of the s3 bucket containing the website contents.
bucketWebsiteURL String
The website URL for the s3 bucket.
websiteURL String
The URL to access the website
cdnDomainName String
The domain name for the CDN.
cdnURL String
The URL for the CDN
logsBucketName String
The name of the s3 bucket containing the access logs.
bucketName string
The name of the s3 bucket containing the website contents.
bucketWebsiteURL string
The website URL for the s3 bucket.
websiteURL string
The URL to access the website
cdnDomainName string
The domain name for the CDN.
cdnURL string
The URL for the CDN
logsBucketName string
The name of the s3 bucket containing the access logs.
bucket_name str
The name of the s3 bucket containing the website contents.
bucket_website_url str
The website URL for the s3 bucket.
website_url str
The URL to access the website
cdn_domain_name str
The domain name for the CDN.
cdn_url str
The URL for the CDN
logs_bucket_name str
The name of the s3 bucket containing the access logs.
bucketName String
The name of the s3 bucket containing the website contents.
bucketWebsiteURL String
The website URL for the s3 bucket.
websiteURL String
The URL to access the website
cdnDomainName String
The domain name for the CDN.
cdnURL String
The URL for the CDN
logsBucketName String
The name of the s3 bucket containing the access logs.

Supporting Types

CDNArgs
, CDNArgsArgs

CloudfrontFunctionAssociations List<Pulumi.Aws.CloudFront.Inputs.DistributionOrderedCacheBehaviorFunctionAssociation>
A config block that triggers a cloudfront function with specific actions.
ForwardedValues Pulumi.Aws.CloudFront.Inputs.DistributionDefaultCacheBehaviorForwardedValues
The forwarded values configuration that specifies how CloudFront handles query strings, cookies and headers. This type is defined in the AWS Classic package.
LambdaFunctionAssociations List<Pulumi.Aws.CloudFront.Inputs.DistributionOrderedCacheBehaviorLambdaFunctionAssociation>
A config block that triggers a lambda function with specific actions.
CloudfrontFunctionAssociations DistributionOrderedCacheBehaviorFunctionAssociation
A config block that triggers a cloudfront function with specific actions.
ForwardedValues DistributionDefaultCacheBehaviorForwardedValues
The forwarded values configuration that specifies how CloudFront handles query strings, cookies and headers. This type is defined in the AWS Classic package.
LambdaFunctionAssociations DistributionOrderedCacheBehaviorLambdaFunctionAssociation
A config block that triggers a lambda function with specific actions.
cloudfrontFunctionAssociations List<DistributionOrderedCacheBehaviorFunctionAssociation>
A config block that triggers a cloudfront function with specific actions.
forwardedValues DistributionDefaultCacheBehaviorForwardedValues
The forwarded values configuration that specifies how CloudFront handles query strings, cookies and headers. This type is defined in the AWS Classic package.
lambdaFunctionAssociations List<DistributionOrderedCacheBehaviorLambdaFunctionAssociation>
A config block that triggers a lambda function with specific actions.
cloudfrontFunctionAssociations pulumiAwstypesinputcloudfrontDistributionOrderedCacheBehaviorFunctionAssociation[]
A config block that triggers a cloudfront function with specific actions.
forwardedValues pulumiAwstypesinputcloudfrontDistributionDefaultCacheBehaviorForwardedValues
The forwarded values configuration that specifies how CloudFront handles query strings, cookies and headers. This type is defined in the AWS Classic package.
lambdaFunctionAssociations pulumiAwstypesinputcloudfrontDistributionOrderedCacheBehaviorLambdaFunctionAssociation[]
A config block that triggers a lambda function with specific actions.
cloudfront_function_associations Sequence[pulumi_aws.cloudfront.DistributionOrderedCacheBehaviorFunctionAssociationArgs]
A config block that triggers a cloudfront function with specific actions.
forwarded_values pulumi_aws.cloudfront.DistributionDefaultCacheBehaviorForwardedValuesArgs
The forwarded values configuration that specifies how CloudFront handles query strings, cookies and headers. This type is defined in the AWS Classic package.
lambda_function_associations Sequence[pulumi_aws.cloudfront.DistributionOrderedCacheBehaviorLambdaFunctionAssociationArgs]
A config block that triggers a lambda function with specific actions.
cloudfrontFunctionAssociations List<Property Map>
A config block that triggers a cloudfront function with specific actions.
forwardedValues Property Map
The forwarded values configuration that specifies how CloudFront handles query strings, cookies and headers. This type is defined in the AWS Classic package.
lambdaFunctionAssociations List<Property Map>
A config block that triggers a lambda function with specific actions.

Package Details

Repository
aws-static-website pulumi/pulumi-aws-static-website
License