How it works...

The configuration of a CloudFront distribution is verbose and boilerplate. The serverless-spa-config plugin simplifies the effort, encapsulates the best practices, and allows for configuration by exception. In this recipe, we use all the defaults. In the generated .serverless/cloudformation-template-update-stack.json template, we can see that the WebsiteBucket is defined and configured as the default S3Origin, with the index.html file as the DefaultRootObject. The PriceClass defaults to North America and Europe, to minimize the amount of time it takes to provision the distribution. The error handling of the bucket (ErrorDocument) and the distribution (CustomErrorResponses) is configured to delegate error handling to the logic ...

Get JavaScript Cloud Native Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.