Howard Dierking

Configuring Akamai with S3 Static Websites

For the next generation of the Concur Developer Center, we decided to break away from the standard enterprise, CMS-backed Web site and do what has become pretty common practice in the open source world for Web sites: we generated a completely static HTML Web site from markdown files using Jekyll.

Even with a static Web site, we want to do as much as possible to reduce latency - especially for mobile devices and parts of the world that may not have tons of bandwith to spare (or just those that happen to be located far from Amazon’s Oregon data center). The solution is also a pretty common one: serve the site through a content delivery network. For our CDN, we went with Akamai.

Now, the origin for the Web site is actually just a bucket in Amazon S3, so it’s reasonable to question why we didn’t go with AWS CloudFront. There are actually quite a few reasons we went with Akamai vs. CloudFront (like the fact that their edge network is enormous), though in truth, the biggest reason in our case is that Concur has had a lot of success with Akamai for many years and so it was a known quantity.

The next step, then, was to configure Akamai to properly front the S3 bucket containing the new Web site. This was my first time working through Akamai’s Luna portal and I learned quite a few things about it as well as had a few surprise learnings about how S3’s static Website hosting feature works. Here’s a quick list of my lessons learned:

dig foo.s3-us-west-2.amazonaws.com

; <<>> DiG 9.8.3-P1 <<>> foo.s3-us-west-2.amazonaws.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36272
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 4, ADDITIONAL: 2

;; QUESTION SECTION:
;foo.s3-us-west-2.amazonaws.com. IN A

;; ANSWER SECTION:
foo.s3-us-west-2.amazonaws.com. 60 IN   CNAME s3-us-west-2-r-w.amazonaws.com.
s3-us-west-2-r-w.amazonaws.com. 5 IN    A   54.231.176.32

As you can see, the friendly hostname that S3 provides when it creates the bucket is just a CNAME to the region-specific S3 hostname. I didn’t dig deeper on this one, but it seems like a reasonable assumption that the bucket identifer is stripped off and then sent along as data which is then used to lookup the bucket in storage.

So there you have it. This captures my experience connecting Akamai’s edge network so that it can serve content from a static Web site hosted in an AWS S3 bucket. Hope it helps if you’re facing a similar challenge, and do let me know if I’ve gotten something wrong in my understanding.

comments powered by Disqus