Skip to content

Instantly share code, notes, and snippets.

@satendrakumar
Last active November 8, 2018 12:58
Show Gist options
  • Save satendrakumar/8c8b16f4ec60618d98a18dd20d406f2a to your computer and use it in GitHub Desktop.
Save satendrakumar/8c8b16f4ec60618d98a18dd20d406f2a to your computer and use it in GitHub Desktop.
Upload and download from/to S3 using boto3 Api
import boto3
s3 = boto3.resource('s3')
def download(bucket_name, key, filePath):
try:
s3.meta.client.download_file(bucket_name, key, filePath)
except ValueError as err:
print('Error:', err)
def upload(filePath, bucket_name, key):
try:
s3.meta.client.upload_file(filePath, bucket_name, key)
except ValueError as err:
print('Error:', err)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment