Skip to content

Instantly share code, notes, and snippets.

@metinsenturk
Created April 27, 2018 02:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metinsenturk/5016d5184e4145520a559170ee0d7a63 to your computer and use it in GitHub Desktop.
Save metinsenturk/5016d5184e4145520a559170ee0d7a63 to your computer and use it in GitHub Desktop.
Upload a File into S3 with Python
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