Skip to content

#Uploading images into AWS S3 Storage  #8

@wnsdudSoftkim

Description

@wnsdudSoftkim

아마존 S3 란 무엇인가?

image
image

내가 하려는 것 - React 앱에서 이미지를 S3버킷에 업로드

1. aws 계정생성 후 S3 스토리지 버킷 생성

https://docs.aws.amazon.com/quickstarts/latest/s3backup/step-1-create-bucket.html

2. CORS 설정

[
{
"AllowedHeaders": [
""
],
"AllowedMethods": [
"GET",
"PUT",
"POST",
"HEAD",
"DELETE"
],
"AllowedOrigins": [
"
"
],
"ExposeHeaders": [],
"MaxAgeSeconds": 3000
}
]

3. 엑세스 키와 보안 키 생성

4. React 로 돌아와서 npm i --save react-s3

5.

import S3FileUpload from 'react-s3
const 구성 = {
      bucketName : '버킷 이름 입력',
      dirName : '폴더 이름 입력', / * 선택 사항 * /
      region : 'Enter Your Bucket region',
      accessKeyId : '여기에 accessKeyId 입력',
      secretAccessKey : 'secretAccessKey 입력'
}
S3FileUpload.uploadFile("이미지파일",config)

결과화면

캡처

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions