A Serverless URL Shortener in a Single CloudFormation Script
Most URL shorteners are managed SaaS products that require you to send your data to third-party servers. If you want to maintain data sovereignty without the overhead of managing a complex applicat...

Source: DEV Community
Most URL shorteners are managed SaaS products that require you to send your data to third-party servers. If you want to maintain data sovereignty without the overhead of managing a complex application, weโve condensed a full serverless stack into a single template.yaml script. The "One Script" USP There are no external dependencies, no complex CI/CD pipelines, and no multi-file microservices to coordinate. You upload one file to AWS CloudFormation, and the stack handles the restโfrom the API ingress to the frontend UI. The Architecture: S3 Metadata Redirection The core "hack" of this stack is that it doesn't use a database (no RDS, no DynamoDB) for redirections. Instead, it leverages S3 Object Metadata. When a URL is shortened, the Lambda function creates an empty object in S3 with the shortened "slug" as the key and attaches the x-amz-website-redirect-location metadata. S3 static website hosting then handles the redirect natively. This results in: 0ms logic latency on the redirect. Ne