Skip to content

felixge/s3.sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

s3.sh

Bash functions for Amazon S3. (Not complete, just scratching my itch)

API

s3_url ${bucket} ${path}

Returns a url for the given ${bucket} and ${path}.

s3_signed_url ${httpMethod} ${bucket} ${path} ${awsKey} ${awsSecret} ${expires:-$((`date +%s`+60))}

Returns a signed url, suitable for making requests to a private s3 object.

role_name="my_role"
temporary_creds=$(curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/${role_name})
awsKey=$(echo ${temporary_creds} | jq -r '.AccessKeyId')
awsSecret=$(echo ${temporary_creds} | jq -r '.SecretAccessKey')
awsToken=$(echo ${temporary_creds} | jq -r '.Token'))
s3_signed_url ${httpMethod} ${bucket} ${path} ${awsKey} ${awsSecret} ${expires:-$((`date +%s`+60))} ${awsToken}

Returns a signed url by credentials provided by an IAM role

Dependencies:

  • date, if ${expires} parameter is not provided
  • openssl

About

Bash functions for Amazon S3. (Not complete, just scratching my itch)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages