These are three liners. Just follow the instructions in the boto3 documentation .
import boto3 s3 = boto3.resource(service_name = 's3') s3.meta.client.upload_file(Filename = 'C:/foo/bar/baz.filetype', Bucket = 'yourbucketname', Key = 'baz.filetype')
Here are some important arguments:
Options:
Filename (
str ) - path to the file to upload.
Bucket (
str ) - the name of the bucket being loaded.
Key (
str ) is the name you want to assign to your file in your s3 bucket. It may be the same as the file name or another name of your choice, but the file type should remain unchanged.
Note. I assume that you saved your credentials in the ~\.aws as suggested in the best configuration settings in the boto3 documentation .
Samuel Nde Nov 29 '18 at 0:20 2018-11-29 00:20
source share