The steps to take
1. Create an account on console.aws.amazon.com
2. Create a user and a new bucket. Note the accessKeyId, the secretAccessKey and ARN
3. Add policy to the bucket and the user, add CORS to the bucket.
1) policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AddCannedAcl",
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:my arn"
]
},
"Action": [
"s3:PutObject",
"s3:PutObjectAcl"
],
"Resource": [
"arn:aws:s3:::onclick/*"
],
"Condition": {
"StringEquals": {
"s3:x-amz-acl": [
"public-read"
]
}
}
}
]
}
2) cors
S3 now expects the rules to be in Array Json format.
[
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET",
"HEAD"
],
"AllowedOrigins": [
"*"
],
"ExposeHeaders": [],
"MaxAgeSeconds": 3000
}
]
Source from
- www.youtube.com/watch?v=cDj4LPTLR3o
- codeytek.com/how-to-create-a-user-and-bucket-amazon-web-services-aws/
- Step to upload from code: codeytek.com/course/upload-files-images-on-amazon-web-services-course/upload-files-images-on-amazon-web-services-content/file-uploads-on-amazon-web-services-aws-multer-s3-node-js-react-js-express-aws-sdk/
- cors: stackoverflow.com/questions/17533888/s3-access-control-allow-origin-header
'Computer Science > Terminology and Concepts' 카테고리의 다른 글
How to use Real-time DB of Firebase (0) | 2021.04.20 |
---|---|
React Convenient Tools - Prettier, ESLint, Snippet (0) | 2021.04.19 |
프론트엔드 필수 반응형 CSS 단위 정리 (0) | 2021.04.08 |
Difference between URI and URL (0) | 2021.04.06 |
Rest API (0) | 2021.04.06 |