urlamazon-web-servicesamazon-s3

Shorten S3 signed url


I'm creating signed URLs and sending them to an external system for later use. Unfortunately there are some length parameters that do not allow extremely long strings to be passed along. Recently, it appears that signed URLs were reformatted and extended which subsequently broke my app.

Is there some method for generating a shorter URL from S3? I would prefer not to rely on a third party URL shortening service for a number of reasons (it's an extra request at URL generation and it adds a point-of-failure).


Solution

  • You can build a very simple URL Shortener directly within Amazon S3:

    Then, when you access the zero-length object (eg mybucket.s3-website-ap-southeast-2.amazonaws.com/pic.jpg) it will actually redirect to the Long URL stored in the metadata.

    Simple, with no database required!