Download object to a file


import boto
import time
import sys
import logging
import boto.s3.connection
import ConfigParser

host = '192.168.9.230'

s3 = boto.connect_s3(
  host = host,
  is_secure = false,
  calling_format = boto.s3.connection.OrdinaryCallingFormat(),
  )

bucket = s3.create_bucket("bucket_name") 1
key = bucket.new_key('amazon.jpg') 2
downloadFile = "downloadfile.jpg" 3
fp = open(downloadFile,'w') 4
key.get_contents_to_file(fp) 5

1 Create a Vault called bucket_name.
2 Create an Object called amazon.jpg.
3 Set the name of the downloaded file to downloadFile.
4 Assign the contents of the downloadFile to the variable fp.
5 Write the Object to the fp file.