Sunday, 19 February 2012

CloudFront Invalidator | Wildcards, Resubmission and Credentials Saving

While I had a lot of fun writing my little tool up, it was not too heartening to see that my hours of work almost seemed rather useless.

Today however, I was able to get some motivation thanks to Toby who was the first user to comment on my little tool.

Toby had two suggestions:

  • Wildcard path submissions
  • Re-submitting previous invalidations

I immediately set off on a mission to get them done.

Wildcard Paths

The first sounded impossible at first since Amazon CloudFront does not accept wildcards as paths. I was able to add a similar feature however - searching through previous paths and matching those with the wildcard.

Here's what you can do now:
  1. Type something like *.js and add all JavaScript files (ending with .js) from history.
That's it, just one step!

Credentials (Cookies) Wiping

There was one aspect of my Invalidator that I was concerned about, the storing of data. I felt that users should have an easy way of opting out and wiping all traces.

Those who have used my lovely little tool before will notice a new red box on the image above. This box lets you do two things:
  1. Enable the saving of history and credentials
  2. Disable the saving of anything and wipe all previous traces
If you have used the Invalidator before, the checkbox will be un-checked but the text fields will be filled in for you.
  • To wipe all data, simply leave the checkbox unchecked and refresh.
  • To keep all data, simply click on the checkbox.
If you are a new user, note that data will only be saved once you have made use of your credentials once (one example is clicking Refresh on the Get Invalidations tab.

Re-submitting Previous Invalidations

This job is now much easier thanks to the glaringly obvious Submit this Invalidation again button.
While viewing the list of invalidations, simply click on an invalidation to get more details about it, then click Submit this Invalidation again to submit the invalidation again.

Actively re-try Get Invalidations requests on failure

An extra feature I added is the retrying of GET requests for Invalidation Lists.

Depending on the status of the YQL server and/or CloudFront server, you may sometimes get failed requests. This can get annoying when you are trying to look at the list for an overview.

I therefore made it so that the tool tries to pull the Invalidation List again in 10 seconds.
This behaviour is cancelled once you switch to a new tab.


Thanks to my hours of work wrestling with Javascript, the whole website in general is much faster as well, both to load and to switch pages.
(Hover your mouse over the search box for a hidden feature!)

If you have any more suggestions, please do not hesitate to ask.
Do use my Online CloudFront Invalidator and share it with your co-workers, family and friends!