npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aws-serverless-api-cloudfront

v0.10.15

Published

CloudFront distribution in front of your API Gateway

Downloads

3

Readme

aws-serverless-api-cloudfront

This package is based on serverless-api-cloudfront

serverless npm version MIT licensed npm downloads

Automatically creates properly configured AWS CloudFront distribution that routes traffic to API Gateway as well as a Route53 A record to point to the distribution from a custom domain name.

Due to limitations of API Gateway Custom Domains, we realized that setting self-managed CloudFront distribution is much more powerful.

:zap: Pros

  • Allows you to set-up a CloudFront distribution for your API Gateway
  • Sets up a Route 53 DNS entry for the CloudFront distribution
  • 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

Installation

$ npm install --save-dev aws-serverless-api-cloudfront

Configuration

  • FullDomainName - This is REQUIRED and is used to determine the Domain name of the CloudFront Distribution as well register the Route53 A record. In addition, the hostname will be extracted from the full domain name and used to find the correct certificate if the certificate ARN is not explicitly provided.
  • All apiCloudFront configuration parameters are optional other than FullDomainName
  • First deployment may be quite long (e.g. 30 min) as Serverless is waiting for CloudFormation to deploy CloudFront distribution.
# add in your serverless.yml

plugins:
  - aws-serverless-api-cloudfront

custom:
  apiCloudFront:
    fullDomainName:  api.my-custom-domain.com
    certificate: (Determined from fullDomainName if not present) arn:aws:acm:us-east-1:000000000000:certificate/00000000-1111-2222-3333-444444444444
    waf: 00000000-0000-0000-0000-000000000000
    compress: true
    logging:
      bucket: my-bucket.s3.amazonaws.com
      prefix: my-prefix
    cookies: none
    headers:
      - x-api-key
    querystring:
      - page
      - per_page
    priceClass: PriceClass_100

Notes

  • cookies can be all (default), none or a list that lists the cookies to whitelist
cookies:
  - FirstCookieName
  - SecondCookieName
  • headers can be all, none (default) or a list:
headers: all
  • querystring can be all (default), none or a list, in which case all querystring parameters are forwarded, but cache is based on the list:
querystring: all
  • priceClass can be PriceClass_All (default), PriceClass_100 or PriceClass_200:
priceClass: PriceClass_100 is the default