Generate Expiring Amazon S3 Link with Custom File Name


There are several ways to download file from Amazon S3. Easiest way is making bucket or file as public. If you want use to download private file, you can use pre-signed URL with expired time.

I found the snippet to generate that URL, but I extended to define custom file name. Here is the code.

https://gist.github.com/hiromitz/9321852

Email me when Hiro Miyanishi publishes or recommends stories