Subscribe
Fenix

Technologies, Hacks and Games...

Latest posts

Importing hand-built AWS resources into Terraform

Everything in my blog's AWS account was clicked together in the console in 2020. Here is how I brought it under Terraform with import blocks, the key pair that wanted to be replaced, prevent_destroy on the live server, and a tiny wrapper that keeps credentials off the screen.

5 min read

Golang Tutorial 9: Arrays and slices

Arrays vs slices in Go, length and capacity, the append gotcha that overwrote my data, copy, and the slices package (Sort, Contains, Index, BinarySearch). Runnable examples on Go 1.27 and a small exercise at the end.

8 min read

Designing a URL shortener from requirements to scale

Part 0 of the shorty series: designing a URL shortener before writing code. Requirements, rough numbers, random base62 codes vs counters and hashes, 301 vs 302, caching hot links in Redis and counting clicks without slowing redirects.

8 min read
AWS

Running a Docker host on EC2 with SSM instead of SSH

How I build the EC2 host for this blog with Terraform: IMDSv2, an encrypted disk, cloud-init for Docker and only ports 80 and 443 open. Changes go in through SSM Run Command, so port 22 stays closed.

6 min read
AWS

Daily EBS snapshots with Data Lifecycle Manager in Terraform

Data Lifecycle Manager takes a snapshot of every EBS volume with a given tag once a day and deletes the old ones for you. Here is the Terraform for the policy and its IAM role, how I tag the root volume, and why I still keep a separate database backup.

5 min read

Calculating Zerodha intraday and delivery charges in Go

A backtest without trading costs will flatter almost any intraday strategy. Here is the small Go function I use to estimate Zerodha brokerage, STT, exchange fees, stamp duty, GST and DP charges for intraday and delivery trades.

5 min read