Created
December 17, 2013 07:46
-
-
Save shantanuo/8001459 to your computer and use it in GitHub Desktop.
upload a file to amazon glaciercopy folder. This has a rule that will archive 7 days old files to glacier to save cost.
This file contains hidden or 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
| # python s3upload.py /path/file.txt | |
| import sys | |
| myfile = sys.argv[1] | |
| import os | |
| onlyfile=os.path.split(myfile)[-1] | |
| import boto | |
| from boto.s3.connection import OrdinaryCallingFormat | |
| c = boto.connect_s3('access_key','secret_key',calling_format=OrdinaryCallingFormat()) | |
| bucket = c.get_bucket('glaciercopy') | |
| from boto.s3.key import Key | |
| k = Key(bucket) | |
| k.key = onlyfile | |
| k.set_contents_from_filename(myfile) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment