Posts

Getting Started with Cloud Init

October 30, 2019
Cloud
aws, iac

In this guide we are going to use cloud-init to bootstrap an apache server on AWS EC2. Introduction Cloud init is a service that comes installed on newer OS distributions. It is able to consume cloud-config files and execute them during the very first boot of a server. Cloud-config files use a declarative syntax (YAML format) to specify common configuration tasks such as: Configuring SSH keys Settting up trusted CA certs Define users Run scripts etc. ...

Notes on the Google Cloud Architect Certification

May 20, 2019
Cloud, Architecture
gcp, certs, career

When Google Cloud launched their Kubernetes platform (GKE) back in 2015 I signed up for the free trial. Today my free credits are long gone, but I still run and launch new clusters on a weekly basis. After putting it off for a while, I recently decided to formalize my experience by getting the GCP Architect certification. In this post I detail some of the resources I used to prepare for the exam. ...

Simple Golang Retry Function

May 29, 2017
Development
golang

Adding retry policies in your software is an easy way to increase resiliency. This is especially useful when making HTTP requests or doing anything else that has to reach out across the network. If at first you don’t succeed, try, try again. In go code, that translates to: func retry(attempts int, sleep time.Duration, fn func() error) error { if err := fn(); err != nil { if s, ok := err. ...

Go: Wrapping http.ResponseWriter with Middleware

June 6, 2017
Development
golang

Using middleware provides a clean way to reduce code duplication when handling HTTP requests in Go. By utilizing the standard handler signature, func(w http.ResponseWriter, r *http.Request) we can write functions that are easily dropped into any Go web service. One of the most common uses of middleware is to provide request/response logging. In order to log responses we will need to capture the status code that was written by a nested handler. ...