“Unggah file ke AWS” Kode Jawaban

Unggah file ke AWS

# 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

file unggah AWS EC2

scp -i ~/Downloads/file.pem local_image_file user@ec2_elastic_ip:/home/user/images/
Cautious Chipmunk

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

Jawaban yang mirip dengan “Unggah file ke AWS”

Pertanyaan yang mirip dengan “Unggah file ke AWS”

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

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya