Serverless Api Cloudfront
- NPM Downloads Last Month
Repo README Contents:
Automatically creates properly configured AWS CloudFront distribution that routes traffic to API Gateway.
Due to limitations of API Gateway Custom Domains, we realized that setting self-managed CloudFront distribution is much more powerful.
- Allows you to set-up custom domain for your API Gateway
- Enables CDN caching of resources - so you don’t waste Lambda invocations or API Gateway traffic for serving static files (just set proper Cache-Control in API responses)
- Much more CloudWatch statistics of API usage (like bandwidth metrics)
- Real world access log - out of the box, API Gateway currently does not provide any kind of real “apache-like” access logs for your invocations
- Web Application Firewall support - enable AWS WAF to protect your API from security threats
$ npm install --save-dev serverless-api-cloudfront
- All apiCloudFront configuration parameters are optional - e.g. don’t provide ACM Certificate ARN to use default CloudFront certificate (which works only for default cloudfront.net domain).
- This plugin does not set-up automatically Route53 for newly created CloudFront distribution. After creating CloudFront distribution, manually add Route53 ALIAS record pointing to your CloudFront domain name.
- First deployment may be quite long (e.g. 10 min) as Serverless is waiting for CloudFormation to deploy CloudFront distribution.
# add in your serverless.yml