Sitefinity AWS CloudFront Invalidation

I have implemented create

  • an intercepter to listen Sitefinity Page Published event
  • a cache invalidation trigger to AWS CloudFront

AWS Setup

Of course CloudFront has to be already setup. Here we are going to setup a middleman user, to power the interface to work.

  1. Create a policy cf-createinvalidation-policy with the permission of CreateInvalidation in CloudFront with All Resources (Wildcard) screen1

  2. Create user groups cf-usergroup, attach the policy cf-createinvalidation-policy

  3. Create a user cf-middleman, add to user group cf-usergroup

  4. Create Access keys from cf-middleman, choose Application running outside AWS and name it as cf-sf

  5. Use the access keys to run the code later


I built it as a seperated module in order to plug and play in different solution and version.

You can follow the steps to setup external library to plug in and play on Sitefinity.

  1. In last line of AssemblyInfo.cs file, insert

    [assembly: PreApplicationStartMethod(typeof(SparksEventSubscriber), "Start")]

  2. Create a SparksEventSubscriber.cs file, and a SparksEventSubscriber.cs file

  3. Create a sparksSetting.json file

    { "CloudFront": { "Profile": "", "DistributionId": "", "AccessKeyId": "", "AccessKey": "" } }

  4. Build the project

  5. For deployment, copy AWSSDK.CloudFront.dll, AWSSDK.Core.dll (if missing from destination), SparksCloudFront.dll and sparksSetting.json to Sitefinity Project

  6. Edit the sparksSetting.json to the relevant project credentials

Finally, go to one of the Page setup in Sitefinity instance, publish and you will see all relevant URLs will be submit for Cache Invalidation.

How to upgrade or download for different Sitefinity version?

Very simple, just go to Manage Nuget Packages screen, change the package source to Sitefinity NuGet Source

Update Telerik.Sitefinity.Core to the desired version.

Documentation / References: