04 AWS S3
node.js를 위한 S3 SDK : 업로드
권한
본 수업을 진행하기 위해서는 사용자나 역할이 AmazonS3FullAccess 권한이 있어야 합니다. iam을 이용해주세요.
s3_put.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | var AWS = require('aws-sdk');var fs = require('fs');AWS.config.region = 'ap-northeast-2';var s3 = new AWS.S3();var param = { 'Bucket':'codingeverybody2', 'Key':'logo.png', 'ACL':'public-read', 'Body':fs.createReadStream('94.png'), 'ContentType':'image/png'}s3.upload(param, function(err, data){ console.log(err); console.log(data);}) |