Martins IrbeI&apos;m a software engineer based in London.<br>I ❤️ coding, photography, games and solving puzzles.http://localhost:4000//
Thu, 11 May 2017 00:04:56 +0100Thu, 11 May 2017 00:04:56 +0100Jekyll v3.4.3AccessDenied, Jekyll on S3<p>I was caught off guard. 🙈<br />
Apparently, <a href="https://aws.amazon.com/s3/">S3</a> doesn’t allow to access static website endpoints if the S3 bucket has been chosen as the origin domain name in the <a href="https://aws.amazon.com/cloudfront/">CloudFront</a> distribution configuration. At first, it’s also not straight forward to understand what exactly is going on. The first thing when I saw the <code class="highlighter-rouge">AccessDenied</code> error message when I tried to open one of my blog posts.</p>
<div class="highlighter-rouge"><pre class="highlight"><code>&lt;Error&gt;
&lt;Code&gt;AccessDenied&lt;/Code&gt;
&lt;Message&gt;Access Denied&lt;/Message&gt;
&lt;RequestId&gt;???&lt;/RequestId&gt;
&lt;HostId&gt;
???
&lt;/HostId&gt;
&lt;/Error&gt;
</code></pre>
</div>
<p>I thought that this was because of the S3 bucket permissions, so after attempting to update the bucket policy, it became evident that this is not the case.
After digging around the internet, I found few older posts that vaguely referred to change the origin to the S3 bucket endpoint. However, it’s not possible once the CloudFront distribution is already created, so here are the steps that I followed!</p>
<ol>
<li>Delete your current CloudFront distribution. It takes around 15 minutes to disable, after which you can delete.</li>
<li>To find out what is your S3 bucket endpoint. Go to your S3 bucket and select <code class="highlighter-rouge">Static website hosting</code> from the <code class="highlighter-rouge">Properties</code> tab and you should be able to see your S3 bucket endpoint which would look something like this <code class="highlighter-rouge">http://aws-website-hello-friend-us-east-1.amazonaws.com</code></li>
<li>While creating the CloudFront distribution, you can enter the S3 bucket endpoint in the <code class="highlighter-rouge">Origin Domain Name</code> field, and that’s pretty much it.</li>
<li>If you have your own domain name which you want to use, you can add a CNAME record that points to the <code class="highlighter-rouge">.cloudfront.net</code> in Route 53.</li>
</ol>
<p>If this helped, let me know! 🚀</p>
Sat, 06 May 2017 00:14:43 +0100http://localhost:4000//2017/static-website-on-s3-continued/
http://localhost:4000//2017/static-website-on-s3-continued/s3awshelphelpMoving to S3<p>A few days ago I migrated my website from <a href="https://www.siteground.com/">SiteGround</a> shared hosting provider to an instance on <a href="https://www.digitalocean.com/">DigitalOcean</a>. By doing so, I have stopped paying around £130 to £46 per year. The main reason why I moved to DigitalOcean was that I got $50 in platform credit from <a href="https://education.github.com/pack">GitHub Student Developer Pack</a>. However, after exploring AWS, I found that it’s possible to host static websites on S3 and it would cost me somewhere between $0.50 - $1.50 per month, which is somewhere around £14 per year. I would say that it’s not bad at all, it’s quite impressive savings from £130 to £14. And a few hours later, here we are, my website now lives on S3 with the help of CloudFront and Route 53. As search engines prefer sites with HTTPS, I also decided to use <a href="https://letsencrypt.org/">Let’s Encrypt</a>, and thanks to <a href="https://github.com/dlapiduz/certbot-s3front">S3/CloudFront plugin for Certbot client</a> it was like a walk in the park.
To setup a static website on S3 you can follow Amazon’s tutorial which can be found <a href="http://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html">here</a>.</p>
Sat, 06 May 2017 00:14:43 +0100http://localhost:4000//2017/moving-to-s3/
http://localhost:4000//2017/moving-to-s3/updatesimprovementsannouncementsGoodbye WordPress and welcome Jekyll! 🎉<p>As a WordPress user, I found myself thinking about some alternatives, not because I wouldn’t like Wordpress, but because of how much resources it demands, especially for a simple personal website, which easily could be few basic static HTML pages. Therefore, I decided to push myself outside my comfort zone to see what else is out there. And then, I stumbled across Jekyll, a static website generator. After some experimentation, it just felt wrong not to use it. One of the main reasons why I decided to migrate over Jekyll was that I wouldn’t need to host PostgreSQL db and Wordpress, instead of that I could use the precious server resources in more efficient ways, for example running my <a href="https://twitter.com/pixelator_bot">Pixelator Twitter bot</a>.</p>
Mon, 01 May 2017 11:14:43 +0100http://localhost:4000//2017/goodbye-wordpress-welcome-jekyll/
http://localhost:4000//2017/goodbye-wordpress-welcome-jekyll/bloggingannouncements