First I want to say Hello to all, second I am very scared since I just got a new job and one of my tasks is something I have never done before in my life. In this case the task I am assigned to is to find a way to delete the cache from the S3 Cloudfront Distributions. I have tried to see if there is a way to list all of the distributions and then clear the cache from them using a script but I could not find if that is even possible and what the script should look like.
The idea that I have is to have a cli script that will:
A) list all of the distributions in a txt file output; B) Read from that output the distributions ID's and afterwards use that output to clear their current cache.
So that afterwards new cache can be created on the distributions after new files have been uploaded. I have read upon https://docs.aws.amazon.com/cli/latest/reference/cloudfront/list-distributions.html but unfortunately I could not grasp how the script would look like to list all of the distributions ID's > distribution.txt and afterwards read from it to delete their cache.
Any tips or information that I can read upon to create such a script if it's even possible will be very helpful, since I am really nervus and scared of my first task.
Want to say thanks to all that have read the topic even if they did not have any tips to give :).