Hiding in the endless feed of new service announcements from AWS, this was undoubtably one of the most important news items for New Zealand. Given the geographic location of New Zealand, having its own edge location was a no brainer, but for so long the question was is there enough content delivered to New Zealand to justify an edge location locally.
It seems the answer is a yes. In fact, New Zealand has got not one, but two edge locations (both in Auckland) and AWS claims that it will provide viewers as much as a 50% reduction in p90 latency measures. These new edge locations are priced within CloudFront’s Australia geographic region.
What is CloudFront and why does it matter?
Amazon CloudFront is the fast content delivery network (CDN) service of AWS, and it helps securely delivering data, videos, applications, and APIs to end users with low latency and high transfer speeds.
As CloudFront natively integrates with other AWS services such as Elastic Load Balancing Amazon EC2 and S3 you can set them up as the origin for your content with minimal effort, also you can utilise Lambda@Edge to run custom code closer to the user. From a security standpoint, CloudFront seamlessly integrates with AWS Web Application Firewall and AWS Shield for DDoS mitigation. Further if AWS services such as Amazon S3, Amazon EC2 or Elastic Load Balancing are used as origins, the data transferred between these services and CloudFront is free.
Does it really make a difference?
In order to get some “real” statistics I setup a CloudFront distribution and ran a few tests. The first task was to find a DNS server in Australia, so I can find an Australian CloudFront IP. Then I ran dig on my CloudFront distribution using one of them as the DNS server.
The IP addresses it resolves to (13.224.180.xx) are all in Australia. Now I ran another dig using a New Zealand based DNS.
This resolves CloudFront to a different set of IP addresses (65.9.137.xx)
Now I pinged one of the Australian CloudFront IP addresses.
I’m getting 27-29 milliseconds, which is on par with the 30ms lag we are all used to when dealing with content distributed via the Sydney region.
Now for the real test, I pinged one of the Auckland based CloudFront IP addresses
This time I’m getting sub 10 millisecond response times, some as low as 3.2 milliseconds.
In order to get a more realistic picture of the timings, I then ran a curl command on a real website (which is delivered via CloudFront) using --resolve flag to force resolving via Sydney and Auckland based CloudFront respectively.
Here we see the x-amz-cf-pop header indicating that we are being served by Sydney CloudFront PoP and the total time it took to receive the response in 0.166 seconds.
This time we see the x-amz-cf-pop header indicating that we are being served by Auckland CloudFront PoP and the total time it took to receive the response in 0.097 seconds.
So, with above examples we can definitively say New Zealand based users can expect a huge boost in response times, when their content is served via CloudFront. Thus, Amazon’s claim on 50% reduction latency measures holds true.
What benefit will this give me in New Zealand?
As we discovered above, you will get a big boost in response time, if your content is delivered from or cached at the edge. The good news is if you are already delivering your content via CloudFront, you are getting this benefit without having to do anything. Your end users may have already noticed an increase in performance.
If you are not using Amazon CloudFront already, and you have a considerable user base in New Zealand, this gives you a very compelling reason to adopt it. Apart from the boost in performance, this will also give you the ability to utilise AWS’s edge computing capabilities such as Lambda@Edge, where you’ll be able to perform things like complex URL rewrites etc at scale, with high availability at an AWS location closest to your end user.
All in all, I believe CloudFront’s two new Points of Presence (PoP) is the most exciting news we’ve had in a while, and it will drastically improve content delivery via CloudFront to the New Zealand market. If you are not already using CloudFront, you should seriously start considering using it.