lambda-cloudflare-purge-cache
AWS Lambda function to purge Cloudflare cache for a zone.
Uses Node.js 6.10.2 runtime version.
The script first uses the list zones endpoint to get the zone identifier. Another request is then made to the purge all files endpoint.
Local installation
- Clone repo.
cp .env-example .env
- Edit
.env
with your Cloudflare API key and email. If you are registered with Cloudflare, you can obtain your API key from the bottom of the "My Account" page, found here: Go to My account. cp event.json-example event.json
- Edit
event.json
with the domain you wish to purge cache. npm install
source .env
npm run invoke