Skip to content

Instantly share code, notes, and snippets.

@jordotech
Created July 25, 2018 20:48
Show Gist options
  • Save jordotech/4de71595bf8efd30287f8c2c3fa03713 to your computer and use it in GitHub Desktop.
Save jordotech/4de71595bf8efd30287f8c2c3fa03713 to your computer and use it in GitHub Desktop.
use boto3 to upload to s3
import boto3
client = boto3.client(
's3',
aws_access_key_id = settings.AWS_ACCESS_KEY_ID,
aws_secret_access_key = settings.AWS_SECRET_ACCESS_KEY,
)
dst = 'media/temp_pdf/somefile.jpg' # This is the destination path inside the bucket
client.upload_file('/my/local/somefile.jpg', 'mybucketname', dst)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment