: 간단하게 데이터를 저장할 수 있도록 도와주는 서비스
key : value의 형태로 담김GET "https://버킷의 이름".s3.amazonaws.com/"데이터이름": MYSQL이 AWS S3에 접근하는 것을 허용하기 위해 생성해야하는 정책
  {
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:GetObjectAcl",
                "s3:GetObject",
                "s3:ListBucket",
                "s3:DeleteObject",
                "s3:PutObjectAcl"
            ],
            "Resource": [
                "arn:aws:s3:::내-버킷-이름/*",
                "arn:aws:s3:::내-버킷-이름"
            ]
        }
    ]
}
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Stmt15076373*****",
            "Effect": "Allow",
            "Principal": {
                "AWS": "{IAM_user의_ARN}"
            },
            "Action": [
                "s3:GetObject",
                "s3:PutObject",
                "s3:DeleteObject"
            ],
            "Resource": "arn:aws:s3:::{내_버킷의_이름}/*"
        },
        {
            "Sid": "Stmt15076373*****",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::{bucket_name}/*"
        }
    ]
}
퍼블릭으로 설정하고 나면 경고를 한다. 원칙적으로는 S3는 public access를 주지 않는것이 보안상 좋다. S3는 private하게 막고 S3 앞에 CloudFront를 붙혀서 CDN 기능을 구현하는것이 정석이긴 하다.
: 한 도메인에 로드되어 다른 도메인의 리소스와 상호 작용하는 클라이언트 웹 애플리케이션에 대한 방법 정의
[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET", "PUT", "POST", "HEAD"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": [
            "ETag"
        ],
        "MaxAgeSeconds": 3000
    }
]
multer : 서버에 이미지 저장 시 사용되는 모듈!
npm install multer-s3 aws-sdkconst multer = require('multer’); 
const upload = multer({ dest: 'uploads/' });
single(fieldname) : 하나의 파일 받아서 저장array(fieldname,최대 개수) : 하나의 필드 명을 가지는 여러개의 파일을 받아서 저장router.post('/', upload.array('photos', 4), (req, res) => { 
console.log(req.files); 
console.log(req.files[0]); // 파일의 인덱스로 접근 
// 위 single에서와 다르게 req.file이 아닌 req.files에로 넘어옵니다. })
fields([fieldname, maxCount},{fieldname,maxCount},...]) : 여러 개의 필드명을 갖는 여러 개의 파일을 받아 저장router.post('/', 
      upload.fields([ 
       	{ name: 'mainImage', maxCount: 1 }, 
        { name: 'subImages', maxCount: 5 } 
	   ]), (req, res) => { 
  console.log(req.files); 
  console.log(req.files['접근하려는 fieldname']); 
})
참고: