cloudfront-invalidate-dist
v1.0.1
Published
Lambda function to be invoked by AWS CodePipeline to invalidate specified paths from a CloudFront distribution.
Downloads
8
Maintainers
Readme
CloudFront Invalidate Distribution
Make your AWS CodePipeline invoke this Lambda function to invalidate a CloudFront distribution.
Prerequisites
Install the Serverless Framework if you don't have it.
npm install -g serverless
Deploy
git clone https://github.com/jweyrich/cloudfront-invalidate-dist.git
cd cloudfront-invalidate-dist
serverless deploy [--aws-profile yourProfile]
Configure your CodePipeline
Open your CodePipeline
Create a new stage
Add a new action
In 'Action Provider' select 'AWS Lambda'
In 'Function name' select the deployed function
In 'User parameters' specify the desired CloudFront distribution and paths to be invalidated. Example:
{ "distributionId": "FP7AWS1WBJLKSX", "objectPaths": [ "/*" ] }
Save the action
Test
Examples of User Parameters
{ "distributionId": "FP7AWS1WBJLKSX", "objectPaths": [ "/*" ] }
{ "distributionId": "FP7AWS1WBJLKSX", "objectPaths": [ "/foo", "/bar/baz.jpg", "/bar/baz/*" ] }