AWS S3 - Python
Upload Files to S3 from specific local folder to specific S3 Path
import boto3 import os def upload_files(path): session = boto3.Session( aws_access_key_id='access key ', aws_secret_access_key='secret key ', region_name='us-east-1 ' ) s3 = session.resource('s3') bucket = s3.Bucket('Bucket Name ') for subdir, dirs, files in os.walk(path): for file in files: full_path = os.path.join(subdir, file) with open(full_path, 'rb') as data: #bucket.put_object(Key=full_path[len(path) + 1:], Body=data) bucket.put_object(Key='upload /'+full_path[len(path) + 0:], Body = data) if __name__ == "__main__": upload_files(r'C:\Users\User Profile\Downloads\s3 ')