hugs (owner)

Revisions

gist: 113136 Download_button fork
public
Description:
Use the boto library to upload a file to S3
Public Clone URL: git://gist.github.com/113136.git
Embed All Files: show embed
Upload-file-to-s3-with-boto.py #
1
2
3
4
5
6
7
8
9
10
import boto
 
BUCKET = 'my-awesome-unique-bucket'
filepath = '/path/to/file/filename.zip'
conn = boto.connect_s3()
bucket = conn.lookup(BUCKET)
key = boto.s3.Key(bucket)
key.name = 'filename.zip'
key.set_contents_from_filename(filepath)