Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

serverless-appsync-cloudfront

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-appsync-cloudfront

CloudFront distribution in front of your AppSync

  • 0.9.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
249
increased by20.87%
Maintainers
1
Weekly downloads
 
Created
Source

serverless-appsync-cloudfront

serverless MIT licensed

Automatically creates properly configured AWS CloudFront distribution that routes traffic to AppSync.

This plugin is modified from serverless-api-cloudfront & serverless-domain-manager plugins to support AppSync instead of API Gateway.

:zap: Pros

  • Allows you to set-up custom domain for your AppSync
  • Web Application Firewall support - enable AWS WAF to protect your API from security threats

Installation

Either point to this repository from your package.json or clone this repo to .serverless_plugins folder in your project.

TODO: pending NPM release

Configuration

  • All appSyncCloudFront 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).
  • 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

plugins:
  - serverless-appsync-cloudfront

custom:
  appSyncCloudFront:
    domainName: my-custom-domain.com
    certificate: 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
    minimumProtocolVersion: TLSv1
    enabled: true

Notes

  • domain can be list, so if you want to add more domains, instead string you list multiple ones:
domain:
  - my-custom-domain.com
  - secondary-custom-domain.com
  • cookies can be all (default), none or a list that lists the cookies to whitelist
cookies:
  - FirstCookieName
  - SecondCookieName
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_All
minimumProtocolVersion: TLSv1
  • enabled can be true (default) or false. Can be used to disable cloudfront distribution deployment.
enabled: true

IAM Policy

In order to make this plugin work as expected a few additional IAM Policies might be needed on your AWS profile.

More specifically this plugin needs the following policies attached:

  • cloudfront:CreateDistribution
  • cloudfront:GetDistribution
  • cloudfront:UpdateDistribution
  • cloudfront:DeleteDistribution
  • cloudfront:TagResource

You can read more about IAM profiles and policies in the Serverless documentation.

Keywords

FAQs

Package last updated on 20 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc