lundi 6 avril 2015

Amazon CloudFront invalidation after 'aws s3 sync' CLI

I have a rails app that uses aws cli to sync bunch of content and config with my s3 bucket like so:


aws s3 sync --acl 'public-read' #{some_path} s3://#{bucket_path}


Now I am looking for some easy way to mark everything that was just updated in sync to be mark as invalidated or expired for CloudFront.


I am wondering if there is some way to use -cache-control flag that aws cli provides to make this happen.


I am aware of CloudFront POST API to mark files for invalidation, but that will mean I will have detect what changed in the last sync, then make the API call. I might have any where from 1000s to 1 file syncing. Not a pleasent prospect. But if I have to go this route, how would I go about detecting changes without parsing the s3 sync's console output of-course.


Thanks!


Aucun commentaire:

Enregistrer un commentaire