Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

upload file to AWS S3

var AWS = require('aws-sdk');
AWS.config.update({accessKeyId: "ACCESS_KEY",secretAccessKey: 'SECRET_KEY'});
var s3bucket = new AWS.S3({params: {Bucket: 'BUCKET_NAME'}});
function uploadFileOnS3(fileName, fileData){
    var params = {
      Key: fileName,
      Body: fileData,
    };
    s3bucket.upload(params, function (err, res) {               
        if(err)
            console.log("Error in uploading file on s3 due to "+ err)
        else    
            console.log("File successfully uploaded.")
    });
}
Comment

upload file to s3

# easy way
import boto3

s3 = boto3.resource(
    service_name='s3',
    region_name='Your region',
    aws_access_key_id='Your id',
    aws_secret_access_key="Your Key")

bucket = s3.Bucket('your bucket name')

bucket.upload_file(Filename='temp.csv', Key='temp.csv')
# file path __________↑                 ↑ 
# (which you want to upload)            |
#                                       |______path (where you want to upload inside bucket)

Comment

upload on s3


aws s3 cp --recursive --acl public-read ./www s3://YourBucketNAme/
Comment

PREVIOUS NEXT
Code Example
Python :: python encoding utf 8 
Python :: input code for python 
Python :: module.__dict__ python 
Python :: Username Promt using Python with Character Limit 
Python :: deep learning with python 
Python :: tqdm command that works both in notebook and lab 
Python :: python list input print 
Python :: python redirect with button click 
Python :: python round 1 decimal place 
Python :: flask form 
Python :: how to change templates folder in flask 
Python :: pandas dataframe any along row 
Python :: append string python 
Python :: turtle graphics documentation 
Python :: python sqrt 
Python :: a int and float. python 
Python :: pandas.get_dummies 
Python :: oops concept in python 
Python :: python __lt__ magic method 
Python :: python lambda key sort 
Python :: getting size of list in python 
Python :: numpy copy a array vertical 
Python :: Looping and counting in python 
Python :: iterate over a list python 
Python :: keras loss plot 
Python :: python run bat in new cmd window 
Python :: how to make a timer using python 
Python :: dict in dict in python 
Python :: strip characters from a string python 
Python :: usage of thread in python 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =