cloudfront-invalidate-cache

2.2.0 • Public • Published

cloudfront-invalidate-cache

Simple CLI to invalidate cache for AWS CloudFront. You can create invalidation with CNAME.

npm NPM Build Status Coverage Status

Installation

npm install cloudfront-invalidate-cache --save

Also, you can install with -g (global) option. Alternatively, you can use npx to run it without installing.

AWS permissions

You need 2 permissions to run cloudfront-invalidate-cache.

  • cloudfront:CreateInvalidation
  • cloudfront:ListDistributions

The minimum policy to run is below.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "CloudFrontInvalidateCache",
            "Effect": "Allow",
            "Action": [
                "cloudfront:ListDistributions",
                "cloudfront:CreateInvalidation"
            ],
            "Resource": "*"
        }
    ]
}

Usage

cloudfront-invalidate-cache --cname your.domain.example.com

Or, without installing,

npx cloudfront-invalidate-cache --cname your.domain.example.com

Argument

cloudfront-invalidate-cache has only one argument.

--cname <domain name> (require)

CNAME alias for the distribution.

APIs

const { invalidateCache } = require('cloudfront-invalidate-cache');

invalidateCache('your.domain.example.com')
  .then(() => {
    console.log('done!');
  })
  .catch(err => {
    console.error(err);
  });

Package Sidebar

Install

npm i cloudfront-invalidate-cache

Weekly Downloads

49

Version

2.2.0

License

MIT

Unpacked Size

6.65 kB

Total Files

7

Last publish

Collaborators

  • shouki-s