Fork me on GitHub

S3 Routing Rules Builder

About me

What is it?

Inspired by Netlify's redirect syntax, build S3 conditional routing rules using a simple syntax as shown below:

/home              /
/blog/my-post.php  /blog/my-post  301
/news              /blog          200
/google            https://www.google.com

Supported Rules

  • The only condition supported is KeyPrefixEquals
  • Redirect can be either ReplaceKeyPrefixWith or ReplaceKeyWith depending whether or not there is a trailing / character
  • If the Redirect destenation starts with http[s], HostName and Protocol will be added to the redirect
  • Adding a status code as the third word will add HttpRedirectCode to the redirect