written by Nicolas Untz on 2017-02-06

I currently host this web site on an AWS nano instance. There is an alternate option using S3 Public Website Hosting along with CloudFront, which I suspect is more cost effective. The nice thing with the S3 option is that you no longer have to worry about managing a server. CloudFront is AWS's CDN solution, it distributes copies of the content on edge nodes for faster client access and it also supports SNI TLS.

In order to test this configuration I created a secondary domain, nuntz.net, hosted on S3/CloudFront, which you can test by using https://nuntz.net/ instead of https://nuntz.com/.

S3 Deployment

Here is the procedure to deploy the site on S3 using Lektor:

{
  "Version":"2012-10-17",
  "Statement":[{
    "Sid":"AddPerm",
        "Effect":"Allow",
      "Principal": "*",
      "Action":["s3:GetObject"],
      "Resource":["arn:aws:s3:::nuntz.net/*"
      ]
    }
  ]
}
$ lektor plugins add lektor-s3
[servers.s3]
name = S3
enabled = yes
target = s3://nuntz.net
$ lektor deploy s3

Faster Access with CloudFront

We can speed up access to the site using AWS's CDN (CloudFront):

That's it, the site is now available.

Performance Comparison

So, how does S3/CloudFront compare to the nano EC2 instance? Well it's slightly faster but not that much, see for yourself:

In conclusion, given the simplicity of the solution, I will likely switch to S3/CloudFront in the future...