Skip to content
On this page

Upload/Download from S3 using curl (Signature Version 2)

An old script I wrote to interact with s3. It's obsolete now.

Usage:

./s3_v2.sh <file_path> <bucket> <method> <prefix>
Requires AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables
PUT Example: ./s3_v2.sh path/to/file bucket-name PUT prefix/
Will upload file path/to/file to s3://bucket-name/prefix/path/to/file
GET Example: ./s3_v2.sh path/to/file bucket-name GET prefix/
Will download file from s3://bucket-name/prefix/path/to/file to path/to/file
Note: prefix is optional

Note

Uses Signature Version 2 which is deprecated but still supported in some regions launched before January, 2014

https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#ConstructingTheAuthenticationHeader

Code on Github Gist -

Made with ❤️ using the awesome vitepress