“Unggah file ke S3” Kode Jawaban

Unggah file ke 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)

Darkstar

Unggah file ke 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.")
    });
}
perl wizz

Unggah di S3


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

Jawaban yang mirip dengan “Unggah file ke S3”

Pertanyaan yang mirip dengan “Unggah file ke S3”

Lebih banyak jawaban terkait untuk “Unggah file ke S3” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya