Articles

Simplifying Messy Conditions: Adaptive Models

Hello! Today we're getting into the thorns of programming. Beware cactus. 🌵 Years ago I found Martin Fowler's article on Adaptive Models. Adaptive models let you replace nests of conditions with a declaration of actions. That pattern has helped clean up my DevOps code a ton of times. Fowler is a better programmer than me. His … Continue reading Simplifying Messy Conditions: Adaptive Models

Python DevOps Code error checking: lint with Pyflakes

Hello! For those unfamiliar with linting (static analysis), read Dan Bader's introduction. There are several linters for Python, but when I'm doing DevOps I use Pyflakes. I love the opening sentence of its design principals: Pyflakes makes a simple promise: it will never complain about style, and it will try very, very hard to never … Continue reading Python DevOps Code error checking: lint with Pyflakes

CodePipeline: Python AWS Lambda Functions Without Timeouts

Hello! Today we're going to cover how to add Python AWS lambda functions to CodePipeline, and specifically how to do that without getting stuck in timeout loops you can't cancel. Copy/pastable code first, details below. Replace the two highlighted lines with the code you actually need to run in the pipeline. The commented raise is … Continue reading CodePipeline: Python AWS Lambda Functions Without Timeouts

Securing AWS Security Groups: Restricting Egress Rules

Good afternoon! Today's article demonstrates a surprisingly easy way to tighten the network-layer permissions in an AWS VPC. (If you're in AWS but you're not in a VPC: 😡) Security Groups have ingress and egress rules (also called inbound and outbound rules). In most SGs, the egress rules allow all traffic to everywhere. You've probably seen … Continue reading Securing AWS Security Groups: Restricting Egress Rules

Better boto3 Error Handling: Stopping Silent Failures

Good morning! Today's post covers a pattern I use to increase my confidence that my infrastructure code is working. It turns silent errors into loud ones. I've handled plenty of code that runs without errors but still ends up doing the wrong thing, so I'm never really sure if it's safe to go to sleep … Continue reading Better boto3 Error Handling: Stopping Silent Failures

CloudFormation: functions like ImportValue and GetAtt inside a Sub

Hello! In CloudFormation, I think !Sub is the best way to generate strings that contain dynamic values. It's better to interpolate, like this: Than to join, like this: Both are common solutions, ${SG} resolves to the same value as !Ref SG, but I think interpolation is the right tool here. Join is better for other … Continue reading CloudFormation: functions like ImportValue and GetAtt inside a Sub