Posts

301 Moved Permanently — The Amazon S3 Region Redirect Trap

Image
  301 Moved Permanently — The Amazon S3 Region Redirect Trap # aws # s3 # devops # cloud When the wrong endpoint makes your bucket vanish. Problem You’ve got a bucket you  know  exists — but every request to S3 throws back: <Error> <Code>301 Moved Permanently</Code> <Message>Moved Permanently</Message> <Endpoint>my-bucket.s3.us-west-2.amazonaws.com</Endpoint> </Error> To your users, it looks like the bucket is gone. To your dashboard, it looks like downtime. But the truth? The bucket is alive and well — just in a different region. Clarifying the Issue The  301 Moved Permanently  error happens when: A bucket is created in one AWS region, but requests are made to the global  s3.amazonaws.com  endpoint or the wrong regional endpoint. DNS or SDK defaults route traffic to the wrong region. Applications assume buckets are globally addressable, when in fact they’re region-scoped. S3 doesn’t auto-fix this f...

Grace Hopper Walks Into a Code Review

Image
  Grace Hopper Walks Into a Code Review # python # coding # programming # softwaredevelopment What happens when Grace Hopper reviews your code Rear Admiral Grace Hopper (1906-1992) pioneered compiler theory and spent her career making programming accessible. She famously kept a nanosecond—a foot-long piece of wire—on her desk to make abstract concepts concrete. This is Part 2 of an ongoing series imagining Grace Hopper reviewing modern Python code. What would happen if she walked into your team's code review? The conference room at MegaCorp has everything: a massive screen, expensive ergonomic chairs, and seven developers who have no idea what's about to happen. They're expecting a routine security audit. Something about "military protocol review" on their payment processing system. The invitation went out three weeks ago, signed by someone in compliance they'd never heard of. What they're getting is me. I'm here as a "consultant," they were ...

The Specialized Archives: defaultdict, Counter, and OrderedDict

Image
  The Specialized Archives: defaultdict, Counter, and OrderedDict # python # coding # programming # softwaredevelopment Timothy's standard filing cabinet had served the library brilliantly, but he kept encountering the same frustrating patterns. Each project required writing the same preparatory code before actual work could begin. Margaret introduced him to the library's specialized filing systems—purpose-built variants designed for common tasks. The Self-Initializing Cabinet Timothy's latest assignment was cataloging books by genre, but he constantly hit the same obstacle: books_by_genre = {} def add_book ( genre , title ): if genre not in books_by_genre : books_by_genre [ genre ] = [] # Always create empty list first books_by_genre [ genre ]. append ( title ) The pattern appeared everywhere—check if a key exists, create a default value, then perform the actual operation. Margaret led him to a cabinet labeled "DefaultDict Archive...