Automatically trigger CDN purge on S3 change
A CDN requires an origin server, which can be a S3 bucket. s3-trigger-purge-cdn are python scripts that run as Lambda functions, and are triggered by file uploads to the bucket. Once triggered, the Lambda function will attempt to purge the old file from the CDN cache. Currently supported CDN vendors:
Standalone Legacy mode
While I started as a project with separate parts for each CDN vendor, the standalone parts will not be maintained anymore.
- Python based: Easy to set up and maintain
- Uses Lambda environment variables: Modify the environment variables to modify the Lambda behavior
- purge or load: On Edgecast, you can decide whether to purge from the edge or load onto the edge
Environment variables will be loaded only at the Lambda cold start
config_filedefaults to multicdn.config.yml
- Install and configure Python, pip and Boto3
- In the project directory, run the following command:
pip install -r requirements.txt -t .This is in order to be able to create a full deployable package for Lambda
- Update the config files. There is a master YAML file, but credentials can also be managed in the
config.pyfiles in each vendor’s folder.
- Run the installation script. It will upload the function and its dependencies to AWS Lambda, as well as create the necessary roles, policies and triggers.
Creating an Edgecast API key: https://support.globaldots.com/hc/en-us/articles/115004003749-Edgecast-Allowing-API-access
Adding authentication to Fastly purge: https://docs.fastly.com/guides/purging/authenticating-api-purge-requests