Shalom Carmel, CIO @ GlobalDots
image 2 Min read

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:

  • Akamai
  • Cloudflare
  • Edgecast
  • Fastly
  • Highwinds

Standalone Legacy mode

  • Edgecast
  • Akamai
  • Highwinds

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

Environment variables will be loaded only at the Lambda cold start

  • debug <true|false>
  • config_file defaults to multicdn.config.yml

General Usage

  1. Install and configure Python, pip and Boto3
  2. 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
  3. Update the config files. There is a master YAML file, but credentials can also be managed in the files in each vendor’s folder.
  4. 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.

Additional Notes

Creating an Edgecast API key:

Adding authentication to Fastly purge:

Good luck!

There’s more to see

3 Industries that can benefit from better CDN monitoring
Content Delivery Network (CDN) Monitoring, Logging & Observability
Miguel Fersen, Senior Cloud Consultant @ GlobalDots 23.08.22

In 2022, global CDN usage is expected to reach over 250 exabytes per month. With more and more industries reaping the benefits of CDNs, CDN monitoring is going to become a valuable new source of information for anyone looking to understand their operational challenges or how their customers interact with their product. Industries all over […]

Read more
CDN Monitoring – No Longer a Luxury
Content Delivery Network (CDN) Monitoring, Logging & Observability
Miguel Fersen, Senior Cloud Consultant @ GlobalDots 23.08.22

CDNs have become a standard component of any serious scaling strategy. With scaling, of course, comes an increased security challenge. This leads to code scanning, log analysis, expensive intrusion detection systems and more, but the data locked away inside of a CDN is often ignored. This data is essential to a strong security posture and […]

Read more
Outpace Your Competition by Delivering the Fastest eCommerce Experience Possible
Content Delivery Network (CDN)
Miguel Fersen, Senior Cloud Consultant @ GlobalDots 25.07.22

Speed is one of the biggest factors to eCommerce success. Today’s consumers demand rapid content delivery and are more willing to walk away than wait. Many brands have mistakenly relied on the seemingly magical powers of the traditional Content Delivery Network (CDN), but outpacing your competition requires a comprehensive approach that accelerates every component of […]

Read more
Unlock Your Cloud Potential
Schedule a call with our experts. Discover new technology and get recommendations to improve your performance.
Book a Demo