Socket
Socket
Sign inDemoInstall

serverless-baseline-invalidate-cloudfront

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-baseline-invalidate-cloudfront

Serverless plugin that allows you to invalidate Cloudfront Cache


Version published
Weekly downloads
30
increased by150%
Maintainers
1
Weekly downloads
 
Created
Source

serverless-baseline-invalidate-cloudfront

Serverless plugin that allows you to invalidate Cloudfront Cache securely, addressing previous security concerns with the vm2 dependency. Based on the original package serverless-cloudfront-invalidate.

Install

Install the updated plugin in your Serverless project.

$ npm install --save serverless-baseline-invalidate-cloudfront

Setup

Incorporate the plugin into your serverless.yml file as the final plugin.

plugins:
  - serverless-baseline-invalidate-cloudfront # Add this as the last plugin.

For CloudFront distributions created within the same serverless.yml, you can specify the distributionIdKey and output the DomainId (as illustrated below).

custom:
  cloudfrontInvalidate:
    - distributionId: "CLOUDFRONT_DIST_ID" # Either distributionId or distributionIdKey is required.
      distributionIdKey: "CDNDistributionId" # Either distributionId or distributionIdKey is required.
      autoInvalidate: true # Set to false to prevent automatic invalidation post-deployment. Defaults to true.
      items: # Specify one or more paths
        - "/index.html"
      stage:
        "staging" # Specify the deployment stage for this invalidation
        # This should align with the provider's stage, e.g., "staging" instead of "prod"
        # Invalidation for this distribution will be initiated with `sls deploy --stage staging`
    - distributionId: "CLOUDFRONT_DIST_ID" # Either distributionId or distributionIdKey is required.
      distributionIdKey: "CDNDistributionId" # Either distributionId or distributionIdKey is required.
      items: # Specify one or more paths
        - "/index.html"
      # Omitting `stage` will trigger invalidation for this distribution across all stages
resources:
  Resources:
    CDN:
      Type: "AWS::CloudFront::Distribution"
      Properties: ....
  Outputs:
    CDNDistributionId:
      Description: "CDN distribution id."
      Value:
        Ref: CDN

Usage

Execute sls deploy. Post-deployment, CloudFront Invalidation will commence. To trigger a standalone invalidation, run sls cloudfrontInvalidate.

FAQs

Package last updated on 17 Mar 2024

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