Please enable JS

Blog

how to upload xml file to amazon s3 bucket

Published on May 31, 2017, 10:03 p.m.

Upload file to s3 bucket

1.  Setup the connection
2.  Load the xml
3.  Drop to your Bucket

Simple as that...

for Info Overload Here

import boto

# setup boto bucket connector and key
connector = boto.connect_s3('awsAccessKeyId', 'awsSecretAccessKey')
bucket = connector.get_bucket('awsStorageBucketName')
botoKey = boto.s3.key.Key(bucket)

# open the file to be uploaded
inFileName = 'file.xyz'
inFileObject = open(inFileName)

s3FileName = "path/to/file.xyz"    # path in s3 bucket
botoKey.key = s3FileName    # set filepath as key
botoKey.content_type = 'text/xml'
botoKey.set_contents_from_file(inFileObject)    # writing to file

"""
# botoKey.set_acl('public-read')    <== include this to make the upload public
"""

inFileObject.close()