Jekyll2020-07-03T13:05:52-07:00http://localhost:4000/feed.xmlThoughts From A Wandering BrainWelcome to my blog, where I will post unadulterated content from my brain. You have been warned.Fuck You AWS2020-07-02T05:44:00-07:002020-07-02T05:44:00-07:00http://localhost:4000/2020/07/02/fuck-you-aws<div style="text-align:center"><img src="/assets/canary.png" /></div> <p><br /> I actually quite like AWS and its offerings. I’m making this post because I’m genuinely curious how to interpret the <a href="https://aws.amazon.com/aup/">AWS Acceptable Use Policy</a>. The static content for this blog is hosted within an AWS S3 bucket. Does saying “Fuck You AWS” constitute offensive content?</p> <p>The section titled ‘No Illegal, Harmful, or Offensive Use or Content’ says:</p> <blockquote> <p>You may not use, or encourage, promote, facilitate or instruct others to use, the Services or AWS Site for any illegal, harmful, fraudulent, infringing or offensive use, or to transmit, store, display, distribute or otherwise make available content that is illegal, harmful, fraudulent, infringing or offensive. Prohibited activities or content include:</p> </blockquote> <blockquote> <p>Offensive Content. Content that is defamatory, obscene, abusive, invasive of privacy, or otherwise objectionable, including content that constitutes child pornography, relates to bestiality, or depicts non-consensual sex acts.</p> </blockquote> <p>“Otherwise objectionable” seems to cast a very wide net. One of my <a href="/2020/07/01/hello-weblog.html">three goals</a> for self hosting this blog was ownership. To me part of ownership is being able to express myself freely. I hoped that meant as long as I worked within the confines of the law I would be in the clear.</p> <p>If this post gets removed then I know I have not fully achieved my ownership goal and it might be time to just host on a pi.</p> <p><br /> P.S. I posted this to hackernews. It made it to the front page and generated <a href="https://news.ycombinator.com/item?id=23717254">some discussion</a>.</p>I actually quite like AWS and its offerings. I’m making this post because I’m genuinely curious how to interpret the AWS Acceptable Use Policy. The static content for this blog is hosted within an AWS S3 bucket. Does saying “Fuck You AWS” constitute offensive content?Hello Weblog and How I Made You2020-07-01T12:53:00-07:002020-07-01T12:53:00-07:00http://localhost:4000/2020/07/01/hello-weblog<div style="text-align:center"><img src="/assets/shawshank.gif" /></div> <p><br /> Welcome to Joe’s Ye Olde Fashioned Weblog. This is the first post! Are you ready? In this one I’ll lay out how this blog was created to maybe inspire other peeps to host their own too. Or maybe not.</p> <p>UP TO YOU.</p> <p>I had three ordered goals when setting out into the great blogknown.</p> <ol> <li>Ease. I can be lazy so I wanted the fewest number of barriers between me and writing/publishing content.</li> <li>Thrift. Less than 5 dollars a month was my goal.</li> <li>Ownership. Medium is easy but by posting you grant them rights to <a href="https://policy.medium.com/medium-terms-of-service-9db0094a1e0f#:~:text=Content%20rights%20%26%20responsibilities,reformatting%2C%20and%20distributing%20it).">publish your content</a>.</li> </ol> <p>After I go over each technological choice I made, let’s revisit these goals and see how I fared.</p> <h2 id="jekyll">Jekyll</h2> <p>I first considered using react to create a simple static site but I really didn’t want to set up all the css to make it look nice (see goal 1, word 5). After googling around for a few minutes I found <a href="https://jekyllrb.com">jekyll</a>. It was created by the founder of github in 2008 and claims to be a blog-aware static website generator. It unsurprisingly powers github-pages.</p> <p>What drew me to jekyll was that I could be as hands off or as hands on as I want. Following the docs was easy enough to get jekyll running locally and after that I just had to choose where to host the static files it generated.</p> <h2 id="aws-s3--terraform">AWS S3 + Terraform</h2> <p>In the daylight hours I am a devops engineer at a company vendor-locked to AWS. Its where I cut my teeth on devops. I and a couple others led the infrastructure-as-code revolution transforming the hodgepodge of bash/python/ansible/cloudformation-on-occasion into one standard across the various microservices.</p> <p>After much deliberation we settled on terraform, i.e. my boss chose for us. I hated it at first because you literally have to use <a href="https://blog.logrocket.com/dirty-terraform-hacks/">hacks</a> to do anything useful. But in the end I grew to love it because you feel smart using <a href="https://blog.logrocket.com/dirty-terraform-hacks/">hacks</a> to do anything useful.</p> <p>And so I went with what I knew because what’s easier? I use AWS resources managed by terraform to host this blog. The three AWS resources I use are: public S3 bucket, Route53 alias to the bucket, and a hosted zone. I also purchased my domain through AWS.</p> <p>Here is a link to my <a href="https://github.com/jmdeon/personal_website/blob/master/main.tf">main.tf</a> which manages the public S3 bucket, Route53 alias, and S3 objects. It assumes you have an AWS hosted zone configured for a domain you own, and a static website contained within a _site directory. If you have that you should be able to plop your hosted zone ID in there, configure the variables to your liking, and run apply.</p> <p>This resource is where the real magic happens.</p> <figure class="highlight"><pre><code class="language-terraform" data-lang="terraform"><span class="k">resource</span> <span class="s2">"aws_s3_bucket_object"</span> <span class="s2">"static_site"</span> <span class="p">{</span> <span class="nx">for_each</span> <span class="p">=</span> <span class="nx">fileset</span><span class="p">(</span><span class="s2">"</span><span class="k">${</span><span class="nx">path</span><span class="p">.</span><span class="k">module}</span><span class="s2">/thoughts/_site"</span><span class="p">,</span> <span class="s2">"**"</span><span class="p">)</span> <span class="nx">bucket</span> <span class="p">=</span> <span class="s2">"</span><span class="k">${</span><span class="nx">aws_s3_bucket</span><span class="p">.</span><span class="nx">b</span><span class="p">.</span><span class="nx">id</span><span class="k">}</span><span class="s2">"</span> <span class="nx">key</span> <span class="p">=</span> <span class="nx">each</span><span class="p">.</span><span class="nx">value</span> <span class="nx">source</span> <span class="p">=</span> <span class="s2">"</span><span class="k">${</span><span class="nx">path</span><span class="p">.</span><span class="k">module}</span><span class="s2">/thoughts/_site/</span><span class="k">${</span><span class="nx">each</span><span class="p">.</span><span class="nx">value</span><span class="k">}</span><span class="s2">"</span> <span class="nx">content_type</span> <span class="p">=</span> <span class="s2">"</span><span class="k">${</span><span class="nx">length</span><span class="p">(</span><span class="nx">regexall</span><span class="p">(</span><span class="s2">".*.css"</span><span class="p">,</span> <span class="s2">"</span><span class="k">${</span><span class="nx">each</span><span class="p">.</span><span class="nx">value</span><span class="k">}</span><span class="s2">"</span><span class="p">))</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="o">?</span> <span class="s2">"text/css"</span> <span class="o">:</span> <span class="s2">"text/html"</span><span class="k">}</span><span class="s2">"</span> <span class="nx">acl</span> <span class="p">=</span> <span class="s2">"public-read"</span> <span class="nx">etag</span> <span class="p">=</span> <span class="s2">"</span><span class="k">${</span><span class="nx">filemd5</span><span class="p">(</span><span class="s2">"thoughts/_site/index.html"</span><span class="p">)</span><span class="k">}</span><span class="s2">"</span> <span class="p">}</span></code></pre></figure> <p>It manages all of the static files contained within the S3 bucket and allows me to simply run <code class="highlighter-rouge">terraform apply</code> to publish new content. The tricky bit was knowing to use etag with an md5 hash to get terraform to pick up changes to files and using a regex to denote html from css so that the site doesn’t look like a mangled html mess.</p> <p>Okay let’s see how I fared with the goals!</p> <h1 id="ease">Ease</h1> <p>My process is now:</p> <ol> <li>Write content using the power of markdown and <code class="highlighter-rouge">jekyll serve</code>’s hot reloading.</li> <li>terraform apply</li> <li>git add -A &amp;&amp; git commit -m “sumthn” &amp;&amp; git push</li> </ol> <p>So far (Day 0) I am enjoying this process.</p> <p>All of the configuration and content is kept in a <a href="https://github.com/jmdeon/personal_website">github repo</a> so I can easily manage it from any machine.</p> <h1 id="thrift">Thrift</h1> <p>Here’s a screenshot of my bill for June. The extra 8 cents was for a sleeping Terraria server so ignore that. <img src="/assets/aws_bill.png" alt="billz" /> Not pictured is the cost for the domain. I paid $85 for 5 years so some simple math says thats $1.42/month. So all told I am paying $1.92/month to host my blog. My goal was $5/month so we’re good!</p> <h1 id="ownership">Ownership</h1> <p>Section 8.1 of the <a href="https://aws.amazon.com/agreement/">AWS User Agreement</a></p> <blockquote> <p>8.1 Your Content. Except as provided in this Section 8, we obtain no rights under this Agreement from you (or your licensors) to Your Content. You consent to our use of Your Content to provide the Service Offerings to you and any End Users.</p> </blockquote> <p>This post is all mine. Thanks AWS and fuck you Medium. :blush: <br /> <br /></p> <hr /> <p><br /></p> <p>So what’s next? I plan to use this blog to post unadulterated content from my brain. Mostly hoping to use it as a live journal for various interests I have like videogames, books, movies, tech, comics, and random other hobbies I dip my toes into. Thanks for reading. :)</p> <p>Love, <br /> Joe</p>Welcome to Joe’s Ye Olde Fashioned Weblog. This is the first post! Are you ready? In this one I’ll lay out how this blog was created to maybe inspire other peeps to host their own too. Or maybe not.