Sitefinity AWS CloudFront Invalidation
sitefinity | NET, CMS, Sitefinity | 2023-01-20
sitefinity | NET, CMS, Sitefinity | 2023-01-20
I have implemented create
Of course CloudFront has to be already setup. Here we are going to setup a middleman user, to power the interface to work.
Create user groups cf-usergroup, attach the policy cf-createinvalidation-policy
Create a user cf-middleman, add to user group cf-usergroup
Create Access keys from cf-middleman, choose Application running outside AWS and name it as cf-sf
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.
[assembly: PreApplicationStartMethod(typeof(SparksEventSubscriber), "Start")]
Create a SparksEventSubscriber.cs file, and a SparksEventSubscriber.cs file
Create a sparksSetting.json file
{
"CloudFront": {
"Profile": "",
"DistributionId": "",
"AccessKeyId": "",
"AccessKey": ""
}
}
Build the project
For deployment, copy AWSSDK.CloudFront.dll, AWSSDK.Core.dll (if missing from destination), SparksCloudFront.dll and sparksSetting.json to Sitefinity Project
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.
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.