s3share is a simple command line tool to share any file with somebody via Amazon S3. It will upload the file itself, create a simple HTML page with a download link and output the URL to it.
Using pip:
$ pip install s3share
From source:
$ git clone https://github.com/philippbosch/s3share.git
$ cd s3share
$ python setup.py install
Create a file called .s3share
with the following content:
[S3]
bucket_name = …
aws_access_key_id = …
aws_secret_access_key = …
bucket_name
should be set to the name of an S3 bucket that you need to create manually, e.g. through the AWS Console.
aws_access_key_id
and aws_secret_access_key
should be set to the respective AWS credentials. See here to find out how to create or retrieve these. You can also omit these two options if you have AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
set up as environment variables.
$ s3share /path/to/some/file
$ s3share -h
usage: s3share [-h] [--no-progress] [--overwrite] file
positional arguments:
file the path to the file to be uploaded
optional arguments:
-h, --help show this help message and exit
--no-progress do not show a progress bar
--overwrite overwrite existing files
Given your bucket_name
configuration option is set to "foo-bar"
, the resulting URL will be http://foo-bar.s3.amazonaws.com/random-string
.
You can also use a custom domain like transfer.mydomain.com
. For this you first need to set up a DNS record for the desired hostname with your DNS provider and make it a CNAME
record pointing to s3.amazonaws.com
. Then create a bucket with the same name as the hostname (transfer.mydomain.com
in this example). The resulting URLs will then be http://transfer.mydomain.com/random-string
.