Created
April 4, 2017 08:37
-
-
Save jovianlin/8ad25f28c8b89a11eb2353ccd23cbc0c to your computer and use it in GitHub Desktop.
Upload stuff to Amazon/AWS S3
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
############# | |
# VARIABLES # | |
############# | |
access_key_id = '<ACCESS KEY ID>' | |
secret_access_key = '<SOME SECRET SHIT>' | |
bucket_name = 'my-awesome-bucket' | |
folder_name = 'upload_folder' | |
file_name = 'uploaded_doge_shit.jpg' | |
############## | |
# Main Sauce # | |
############## | |
from boto3.s3.transfer import S3Transfer | |
import boto3 | |
client = boto3.client('s3', aws_access_key_id = access_key_id, aws_secret_access_key = secret_access_key) | |
transfer = S3Transfer(client) | |
file_path = 'data/img/doge_taco.jpg' | |
transfer.upload_file(file_path, bucket_name, folder_name+'/'+file_name) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment