Why we moved to CloudFront Content Delivery Network

A couple of months back I broke our website. I didn’t mean to, and I should’ve know better, but one quiet Thursday evening I broke our website. It’s what’s known as a success disaster. Apparently.

All I did was write a short blog post about the new Raspberry Pi Zero which had just been announced that morning. In case you don’t know the Pi Zero is a computer that fits in the palm of your hand and it was being given away free with a magazine — and the regular price for the Zero is just £4! This is obviously very cool so I wrote a short post, stuck it on our company website and tweeted the following:

Then the magazine retweeted it (despite me getting their Twitter handle wrong, it’s actually @TheMagP1) and a few folk clicked through. Nice! Then the Raspberry Pi foundation retweeted it. They’ve got about 250,000 followers. My phone was buzzing every few seconds to announce further retweets and likes. And hundreds of people clicked the link to read my blog post! I was really pleased until I realised our website had gone down.

Which lead to…

Panic!

I was completely unprepared for such an influx of traffic despite warning clients of such a possibility in the past. To be honest, I never really expect people to read my blog posts. I mean people do, but usually we’re talking tens of people not hundreds. And certainly not hundreds within the space of a a couple of minutes. At first I couldn’t figure out what to do. I thought about asking Raspberry Pi to delete the tweet but this felt like my moment of Twitter fame (silly I know) and I wanted to cling onto it. Then I realised, I had also put the blog on Medium. If I could just send the traffic there instead everything would go back to normal. I set up a redirect from our website and breathed a sigh of relief as our little server perked right up again. Everyone who now clicked the link was able to read the post on Medium but this was traffic that could’ve been on our website and I’d lost it.

What could I have done to prevent this?

There are a few things I could’ve done to save myself from this problem.

Option 1: Not write the post in the first place

Nothing would’ve gone wrong but (and this is for those of you who like Bible references) I would’ve been like the servant that buried the money that time. I wouldn’t have lost anything but I wouldn’t have gained anything either.

Option 2: Used a custom URL shortener

A custom URL shortener is a simple little webapp that redirects people from one URL to another. Media outlets use these a lot to ‘brand’ links on social media. So you might see a link like this: nyti.ms/1R29nvM but when you click it you actually end up here: http://www.nytimes.com/2015/12/29/arts/lara-croft-has-company-more-female-heroes-appear-in-big-budget-games.html?smid=tw-nytimes&smtyp=cur&_r=0.

Short links like this can also hide tags which provide extra info for analytics tracking (e.g. ‘smid=tw-nytimes’ in the example above). Had I included a redirected link in my original tweet I could have easily changed the destination URL to alter where people ended up after clicking it. This is similar to what I actually did here but it would’ve been easier for me to put things right quickly. There are various pros and cons to link shorteners which I may explore in a future post.

Option 3: Use a Content Delivery Network

This is what I actually should have done in the first place. A Content Delivery Network (abbreviated to CDN) is basically a service which copies all the files from your website and distributes them to several servers across the world. This means that no single server ever gets hit with too much traffic. It also means that your site will load much faster for various reasons including the fact that users get the copy of your site stored closest to them geographically. Using a CDN really is the best option for most websites (perhaps all sites?) and I’ve now set this up for ours. Why hadn’t I just done this as standard? Honestly I thought it would be complicated and time consuming. And it was a bit the first time. But so is trying to figure out what to do when your website gets knocked offline by people actually reading the damn thing. I’ve set up a few sites on the CloudFront CDN now and it’s pretty straightforward once you get used to it. And it’s so worth it. I no longer have to worry about our website going down at random times.

Most importantly of all I should have believed more in the content I wrote. Well over 600 people clicked the link to my post and my original tweet got loads of retweets and likes. I wrote that blog post because I was seriously impressed with what Raspberry Pi are doing. It’s not the greatest blog post but I guess that’s the point: It doesn’t have to be.

So here’s my lesson to myself: Don’t worry about ‘writing great content’ just write something real that you care about. You probably won’t get hundreds of readers but you should definitely have a good web hosting and move your site to a Content Delivery Network just in case.

Pete Clark

Pete Clark has been working with websites since the 1990s, which seems like a very very long time ago now. You can follow him on Twitter @ClarkCX