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.
- Near-zero cost (you only pay for S3 storage and CloudFront data transfer).
- Infinite scaling without provisioning database throughput.
Feature Comparison
| Feature | Community (GPL-3.0) | Paid IaaS | Managed SaaS |
|---|---|---|---|
| Deployment | us-east-1 only | Single Script | No Setup (API) |
| Deployment | Single Script | Single Script | No Setup (API) |
| Region | Single Script | Global | Global |
| URL Customization | Random Slugs | Custom Slugs | Custom Slugs |
| Expiration | None | Time & Click limits | Time & Click limits |
| Analytics | None | Click Tracking | Click Tracking |
| License | Non-Commercial | Commercial/Enterprise | Commercial/Enterprise |
| Support | Community | Live Chat / Email | Live Chat / Email |
How to Deploy (Community Edition)
The Community Edition is open-sourced on GitHub. It is a functional baseline for non-commercial projects in us-east-1.
- Download/Clone the Repo: silverlining-cloud/aws-self-hosted-url-shortener
- Upload the template:
aws s3 cp template.yaml s3://<YOUR_BUCKET_NAME>/
- Execute the Stack:
aws cloudformation create-stack --stack-name url-shortener \
--template-url https://<YOUR_BUCKET_NAME>.s3.amazonaws.com/template.yaml \
--capabilities CAPABILITY_NAMED_IAM \
--region us-east-1
Commercial & Enterprise Tiers
If you are deploying this for a client, a company, or need to run it outside of us-east-1, we offer two professional paths:
- Paid IaaS (AWS Marketplace): Purchase a commercial license and unlock multi-region support, custom slugs, and link expiration. Everything still runs in your own VPC.
- Managed SaaS (Marketplace API): Skip the infrastructure entirely. Use our API and pay $0.004 per link directly through your existing AWS/Azure bill.
Links
GitHub: Community Edition
Marketplace: Commercial Version
Documentation: API Playground
Quick Note: If you’re a Dev Lead looking to "burn down" remaining quarterly cloud credits, the Marketplace version is a pre-approved way to add this utility to your stack without a new procurement cycle.
Top comments (0)