ctag support for Terraform

Anyone working in the land of systems and infrastructure automation these days will no doubt have heard of Terraform. At work, we use it for pretty much everything, and being a long time vim user and fan, I wanted to work a little bit smarter as I spend a lot…

Find EC2 region an instance resides in

Quite often you'll find yourself needing to know the region your instance resides in. I've seen this done a couple of ways: $ curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone | sed -e 's/\([1-9]\).$/\1/g' This is pretty ugly, so I prefer to use this method…

Sniffing Elasticsearch Queries

Recently at work we were trying to find out exactly what query was running that was causing an exception in our application. Fortunately, this was quick and easy using good old tcpdump: # tcpdump -A -nn -s 0 \ "tcp dst port 9200 and \ (((ip[2:2] - ((ip[0]&0xf)…

What is listening on my server?

Being a sysadmin, you'll probably often need to find out what is running on a server. There are several ways to do this on Linux: # netstat -nlptu Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:…

Nginx tips and tricks

Redirect root of domain to somewhere else: server { server_name zombix.org www.zombix.org; location = / { rewrite ^ http://about.me/z0mbix permanent; } } Redirect www.domain.com to domain.com: server { server_name www.z0mbix.io; return 301 $scheme://z0mbix.io$request_uri; } Redirect all HTTP requests to HTTPS: server { server_…