Created
April 27, 2018 02:47
-
-
Save metinsenturk/5016d5184e4145520a559170ee0d7a63 to your computer and use it in GitHub Desktop.
Upload a File into S3 with Python
This file contains 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
import boto3 as boto | |
# variables | |
key = 'product.csv' | |
file_path = 'product.csv' | |
bucket_name = 'bucket_name' | |
# init aws | |
client = boto.client('s3') | |
# create bucket | |
response = client.create_bucket( | |
Bucket=bucket_name | |
) | |
# put object | |
response = client.put_object( | |
Key=file_path, | |
Bucket=bucket_name, | |
Body=open(file_path, 'rb') | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment