Getting error while transferring files from ec2 to s3 using boto
As I didn't get any update how to make it work I used s3cmd
in my bash script. But I have to still test it for files >1gb.
Here is the updated code -
#!/bin/shMONGODB_SHELL='/usr/bin/mongo'DUMP_UTILITY='/usr/bin/mongodump'DB_NAME='amicus'date_now=`date +%Y_%m_%d_%H_%M_%S`dir_name='db_backup_'${date_now}file_name='db_backup_'${date_now}'.bz2'log() { echo $1}do_cleanup(){ rm -rf db_backup_2010* log 'cleaning up....'}do_backup(){ log 'snapshotting the db and creating archive' && \ ${DUMP_UTILITY} -d ${DB_NAME} -o ${dir_name} && tar -jcf $file_name ${dir_name} log 'data backd up and created snapshot'}save_in_s3(){ log 'saving the backup archive in amazon S3' && \ python aws_s3.py set ${file_name} && \ s3cmd put ${file_name} s3://YOURBUCKETNAME log 'data backup saved in amazon s3'}do_backup && save_in_s3 && do_cleanup
This probably has to do with the size of the file uploaded.
"Connection reset by peer" usually means that the remote server closed the connection (don't think it's a boto problem). Also going to guess this is some sort of timeout you are hitting for making the request (for a large file the transfer takes a lot of time).
I would recommend to look into multipart uploads if you want to do this yourself. See this example: https://gist.github.com/chrishamant/1556484
s3cmd does this in the back based on the file size.