Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Use S3 as a url short-linker / redirection service
#!/bin/bash -x
if [[ $# -eq 0 ]] ; then
echo 'Usage: cmd <s3 path> <redirect-location>'
echo 'e.g.'
echo ''
exit 0
cd ~/Desktop
rm index.html || :
touch index.html
s3cmd put --acl-public index.html s3://${S3_PATH}/index.html
s3cmd modify --add-header=x-amz-website-redirect-location:${REDIRECT_URL} s3://${S3_PATH}/index.html
s3cmd modify --add-header='Content-Type: text/html' s3://${S3_PATH}/index.html
open ${S3_PATH}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.