Created
May 31, 2011 10:13
-
-
Save ghawkgu/1000263 to your computer and use it in GitHub Desktop.
Writing into s3 with boto.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from boto.s3.connection import S3Connection | |
from boto.s3.key import Key | |
conn = S3Connection('access key', 'access secret') | |
bucket = conn.get_bucket('some-bucket') | |
# Write into 'mysql/test.txt' | |
k = Key(bucket) | |
k.key = 'mysql/test.txt' | |
k.set_contents_from_string('Test message.') | |
# How to load the content from a local file and then writing into s3 | |
# k.set_contents_from_file(open('/home/xxx/test.txt')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment