You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1) Setup S3 bucket with Cloudfront distribution in front of it. This app returns Cloudfront links after you upload the image. [This video](https://www.youtube.com/watch?v=kbI7kRWAU-w) can help you with that.
14
-
2) Create IAM user with following policy (replace "your-bucket-name" with your actual bucket name)
32
+
1) Setup two AWS S3 buckets - one is for serving images (server-bucket) via Cloudfront distribution (CDN) and second is for storing raw images (storage-bucket)
33
+
- <small>S3 bucket for storage is optional</small>
34
+
- <small>Make sure to enable versioning in your S3 buckets, otherwise you might accidentally delete your images</small>
35
+
- <small>[How to setup a Cloudfront distribution](https://www.youtube.com/watch?v=kbI7kRWAU-w)</small>
36
+
2) Create IAM user with following policy (replace "server-bucket-name" and "storage-bucket-name" with your actual bucket name)
15
37
```
16
38
{
17
39
"Version": "2012-10-17",
@@ -25,8 +47,10 @@ Run it on localhost to optimize and upload images to S3. Retrieved links of uplo
25
47
"s3:ListBucket"
26
48
],
27
49
"Resource": [
28
-
"arn:aws:s3:::blazing-peon-images",
29
-
"arn:aws:s3:::blazing-peon-images/*"
50
+
"arn:aws:s3:::server-bucket-name",
51
+
"arn:aws:s3:::server-bucket-name/*",
52
+
"arn:aws:s3:::storage-bucket-name/*",
53
+
"arn:aws:s3:::storage-bucket-name/*"
30
54
]
31
55
}
32
56
]
@@ -50,3 +74,6 @@ Run it on localhost to optimize and upload images to S3. Retrieved links of uplo
50
74
- <small>#2 Upload Form</small>
51
75
5)**Fill in the new image name** (technically S3 namespace) <small>-> it will be automatically prefixed with assets/</small>
52
76
6)**Click upload** <small>-> image will be uploaded to S3 bucket and Cloudfront link will be returned</small>
0 commit comments