Skip to main content

AwsCloudFrontServiceModuleSchema

AwsCloudFrontServiceModuleSchema is the input schema for the AwsCloudFrontServiceModule module. It describes one CloudFront distribution: its origins, its routes, its error responses, and the domains and certificate it answers on.

@group

Modules/Service/AwsCloudFrontService

@see

AwsCloudFrontServiceModule to learn more about the AwsCloudFrontServiceModule module.

Index

Properties

account

account: Account

The AWS account the distribution is created in.

optionalaliases

aliases?: string[] = []

The custom domain names the distribution answers on, e.g. docs.example.com. Each one needs a DNS record pointing at the distribution, which this module does not create. Leaving this empty serves on the *.cloudfront.net domain CloudFront assigns.

optionalcachePolicies

cachePolicies?: CloudFrontCachePolicySchema[] = []

Custom cache policies, which routes name as { kind: 'custom', name }.

optionalcertificateArn

certificateArn?: string | null = null

The ARN of the ACM certificate covering every entry in aliases. CloudFront only reads certificates from us-east-1. Required when aliases is set.

optionaldefaultRootObject

defaultRootObject?: string = ''

The object served for a request to the root, e.g. index.html. Empty serves nothing there.

distributionName

distributionName: string

The name of the distribution. Changing it replaces the distribution.

optionalerrorResponses

errorResponses?: CloudFrontCustomErrorResponseSchema[] = []

What a viewer gets when an origin answers with an error.

These apply to the whole distribution, not to one route: a rule answering every 404 with /index.html and a 200, as a single-page app wants, also turns an API's real 404s into a page of HTML. A distribution serving both should do the single-page-app fallback with an edge function on the website's route instead. A closed bucket reports a missing file as 403.

optionalfunctions

CloudFront Functions to create, which routes run by functionName.

optionaloriginRequestPolicies

originRequestPolicies?: CloudFrontOriginRequestPolicySchema[] = []

Custom origin request policies, which routes name as { kind: 'custom', name }.

origins

Where the distribution fetches from. See AwsCloudFrontServiceModuleOriginSchema.

optionalpriceClass

priceClass?: PriceClass_100 | PriceClass_200 | PriceClass_All = 'PriceClass_All'

Which edge locations serve the distribution, which is what it costs. See ICloudFrontPriceClass.

optionalresponseHeadersPolicies

responseHeadersPolicies?: CloudFrontResponseHeadersPolicySchema[] = []

Custom response headers policies, which routes name as { kind: 'custom', name }.

routes

The routes, each naming an origin. See AwsCloudFrontServiceModuleRouteSchema.