Using Terraform to manage redirects

S3 has a few neat features, like letting you publish your webpage or store backups. But one of my favorite features is the ability to set up more or less maintenance-free redirects. This is super useful when you’re in a corporate environment where domain name changes are quite frequent, either due to rebranding or similar.

So, say you want to redirect all traffic on to, then a simple configuration like this is enough.

This only works when you want to redirect regular HTTP traffic, if the endpoint you’re redirecting from was using TLS you have to put CloudFront with certificates from Certificate Manager in front.

Published: 26 December, 2018