Skip to main content

Amazon Web Services II

This blog keeps moving from one web hosting solution to another like there is no tomorrow. I already wrote about moving it up to the Amazon Web Services once. Then the website was moved onto Google's Blogger platform. Then, if I remember it correctly, onto Wordpress. Now I'm moving it back to AWS again. But this time it is a static content hosting on S3. How do you host a blog as a static content - if you ask me? Then here is how.

So that is it. This particular web-site, being my beloved guinea pig, has moved onto Amazon Simple Storage Service (S3) to test the Amazon Web Services again in the field. This time it is a static content hosting.

Why static? Well, let me ask you a counter question: what's static? In general, static means something that doesn't change over time. And one may argue that a website content should not be static. Otherwise it's going to be boring. A blog cannot be static. A blog is a series of updates, it's dynamic. Right?

Not quite. If you take a period of time short enough anything can be not changing over that period which, by definition, means it's static. Take any blog or even a news website, between updates they all are quite static. Unless you are running an interactive service like a chat or a forum where the visitors of your website can change the content you don't really need a real-time content processing on the web server. If everything on the website is maintained by you or by a limited group of people the updating process can be moved out from the web server in to a backend. And then the backend can update the static content on the server. For the visitor of the website it will look like a constantly updating content. But technically, from the web-server perspective the content is completely static.

Another aspect is that some dynamic processing might be needed if the website does something behind the scenes that depends on the behavior of the visitors. E.g. tracking them, collecting the visitors' personal information for advertisement or to sell this private information to third parties. I don't do such things on my website. So I don't need this functionality. My website can be completely static. Privacy is important.

For this website, as this is my first experiment with static hosting, I picked Nikola. I can't tell why, just searched on the web for static website generators and Nikola was one of the top results. And Nikola was the one that is in Python. So I thought: I know Python so why not. So Nikola it is. I have the sources of my website in a Git repository. Then I generate the HTML and all other content for my static website with Nikola and upload the changes to an S3 bucket where the website is served from. That is it. Well, there are many knobs and dials you can tune both on the Nikola backend and in AWS and there is also AWS CloudFront. But those are technical details and they are well documented in their respective support sites. I won't duplicate it here.