#Infrastructure
446 posts
Terraform in Practice #2 VPC Network as Code: Subnets Across Two AZs, Routing, and the NAT Gateway
We build the VPC that the myapp infrastructure stands on. Public and private subnets go across two AZs with for_each, an internet gateway and route tables define the traffic paths, and a NAT gateway carries private outbound traffic with the cost trade-off made explicit. We wrap up by organizing the network outputs so the compute layer in the next part has everything it needs.
PostgreSQL in Practice #9 Backups, PITR, Upgrades: The Art of Rewinding to Just Before the Incident
The practice series closes with the last layer that protects data. Physical backups (pg_basebackup) combined with WAL archiving to get past pg_dump's limits, how PITR (Point-In-Time Recovery) rewinds to a chosen moment and setting the recovery target, the role split of "a delete accident cannot be undone by failover" between replication and backups, the three roads of a major version upgrade (pg_dump, pg_upgrade, logical replication), and a retrospective of the whole track.
Terraform in Practice #1 Project Design and Bootstrap: The Big Picture, Backend, and Common Tags
Before writing a single resource, we draw the full architecture of the web service infrastructure this ten-part series builds as code, and set down where lab costs arise and the principles for managing them. We bootstrap the state bucket and S3 backend, pin the provider version, and wire up default_tags so every resource gets common tags automatically — the groundwork that puts the practice series on its starting line.
PostgreSQL in Practice #8 Replication and High Availability: Streaming Replication, Read Scaling, Failover
Replication, the standard means of getting past a single server's limits. How streaming (physical) replication ships WAL as-is, replication lag under the asynchronous default and the read-your-writes problem, the trade-offs of synchronous replication, cautions when spreading read load to standbys, what automated failover actually requires (Patroni and friends) and split-brain, where logical replication fits with its per-table selection, and how it all maps onto managed services.
SRE in Practice #6 Reducing Toil: Measuring Manual Work, Automating It, and an Adoption Roadmap
The series finale, on toil: the criteria that identify it — manual, repetitive, automatable, tactical — the 50% rule that stops operational work from swallowing engineering time, prioritizing automation by frequency times duration weighted by risk, the ladder from runbooks to scripts to self-service, and a realistic order for introducing everything in this series, from SLOs to toil management, into an organization.
Terraform Basics #9 Remote State and Collaboration: S3 Backend, Native Locking, and Protecting Sensitive Data
Walking through the three problems local state hits in team collaboration, then the S3 backend configuration and the migration flow init guides you through. We cover how use_lockfile native locking prevents concurrent runs and why the DynamoDB approach became legacy, plus versioning, encryption, and access control for the state bucket — wrapping up the basics series.
PostgreSQL in Practice #7 Partitioning: Splitting Giant Tables by Time
Declarative partitioning, the standard prescription for tables in the hundreds of millions of rows. What partitioning actually solves (deleting old data becomes a single DROP, partition pruning, spreading the VACUUM burden) and what it does not, the RANGE syntax for monthly tables, the constraint that the partition key must be part of the primary key, what query conditions enable pruning, the operational duty of creating future partitions and pg_partman, and the criteria for when to adopt it.
SRE in Practice #5 Postmortems: Blameless Reviews and Keeping Action Items Alive
Turning incidents into organizational learning: why blamelessness is an information-gathering strategy rather than kindness, trigger criteria for which incidents get a postmortem, the template running from timeline through impact and root-cause analysis to action items, the questioning method that refuses to stop at human error and digs down to system causes, and the tracking rules that keep action items from rotting in the backlog.
Terraform Basics #8 Module Basics: Reusing Resource Bundles and Registry Modules
Starting from the fact that every Terraform directory is already a module, we build a child module that takes variables as inputs and outputs as results, and call it with a module block. We also cover pulling battle-tested modules from the registry with version pinning, plus the criteria for splitting modules and where over-splitting begins.
PostgreSQL in Practice #6 Locks and Concurrency: Deadlocks, DDL Locks, SKIP LOCKED
The territory MVCC does not solve: locking. The two layers of row locks (write-vs-write conflicts) and table locks (DDL), tracing lock waits with pg_locks and pg_blocking_pids, the structure that produces deadlocks (cross-order updates) and the prevention rule (always lock in the same order), making read-decide-write safe with SELECT FOR UPDATE, and the standard work-queue pattern FOR UPDATE SKIP LOCKED.
SRE in Practice #4 On-Call Operations: Rotations, Escalation, Load Management
Designing an on-call system that people can sustain: the minimum headcount that makes a rotation viable and the shift structures, the escalation chain for when the primary responder is stuck, the handoff routine between shifts, why pages-per-shift needs a measured ceiling, securing follow-up time to pay down what on-call uncovers, and the compensation and culture without which none of it lasts.
Terraform Basics #7 Resource Lifecycle Control: Replacement Conditions, create_before_destroy, prevent_destroy
How to read from a plan which attribute changes end as an update and which ones force a resource replacement. We cover create_before_destroy, which flips the replacement order to reduce downtime, prevent_destroy, which blocks deletion of production resources, ignore_changes, which tolerates changes made outside the code, and forcing a replacement with the -replace flag.