@@ -11,6 +11,7 @@ import defaultSettings from '@assets/file-uploads/default-settings.png';
1111import newBucket from ' @assets/file-uploads/new-bucket.png' ;
1212import permissions from ' @assets/file-uploads/permissions.png' ;
1313import cors from ' @assets/file-uploads/cors.png' ;
14+ import corsExample from ' @assets/file-uploads/cors-example.png' ;
1415import username from ' @assets/file-uploads/username.png' ;
1516import keys from ' @assets/file-uploads/keys.png' ;
1617
@@ -61,52 +62,58 @@ To do so, follow the steps in this external guide: [Creating IAM users and S3 bu
6162Once you are logged in with your IAM user, you'll need to create an S3 bucket to store your files.
6263
63641 . Navigate to the S3 service in the AWS console
64- <Image src = { findS3 } alt = " find s3" loading = " lazy" />
65+ <Image src = { findS3 } alt = " find s3" loading = " lazy" />
65662 . Click on the ` Create bucket ` button
66- <Image src = { createBucket } alt = " create bucket" loading = " lazy" />
67+ <Image src = { createBucket } alt = " create bucket" loading = " lazy" />
67683 . Fill in the bucket name and region
68694 . ** Leave all the settings as default** and click ` Create bucket `
69- <Image src = { defaultSettings } alt = " bucket settings" loading = " lazy" />
70+ <Image src = { defaultSettings } alt = " bucket settings" loading = " lazy" />
7071
7172### Change the CORS settings
7273
7374Now we need to change some permissions on the bucket to allow for file uploads from your app.
7475
75761 . Click on the bucket you just created
76- <Image src = { newBucket } alt = " new bucket" loading = " lazy" />
77+ <Image src = { newBucket } alt = " new bucket" loading = " lazy" />
77782 . Click on the ` Permissions ` tab
78- <Image src = { permissions } alt = " permissions" loading = " lazy" />
79+ <Image src = { permissions } alt = " permissions" loading = " lazy" />
79803 . Scroll down to the ` Cross-origin resource sharing (CORS) ` section and click ` Edit `
80- <Image src = { cors } alt = " cors" loading = " lazy" />
81- 5 . Paste the following CORS configuration and click ` Save changes ` :
82- ``` json
83- [
84- {
85- "AllowedHeaders" : [
86- " *"
87- ],
88- "AllowedMethods" : [
89- " PUT" ,
90- " GET"
91- ],
92- "AllowedOrigins" : [
93- " *"
94- ],
95- "ExposeHeaders" : []
96- }
97- ]
98- ```
81+ <Image src = { cors } alt = " cors" loading = " lazy" />
82+ 5 . Insert the correct CORS configuration and click ` Save changes ` . You can
83+ copy-paste most of the config below, but ** you must edit the
84+ ` AllowedOrigins ` field** to fit your app. Include ` http://localhost:3000 ` for
85+ local development, and ` https://<your domain> ` for production.
86+ ```json { 11 ,12 }
87+ [
88+ {
89+ " AllowedHeaders" : [
90+ " *"
91+ ],
92+ " AllowedMethods" : [
93+ " PUT" ,
94+ " GET"
95+ ],
96+ " AllowedOrigins" : [
97+ " http://localhost:3000" ,
98+ " https://<your-domain>"
99+ ],
100+ " ExposeHeaders" : []
101+ }
102+ ]
103+ ```
104+ As an example, here are the CORS permissions for this site - https://opensaas.sh :
105+ <Image src = { corsExample } alt = " cors-example" loading = " lazy" />
99106
100107### Get your AWS S3 credentials
101108
102109Now that you have your S3 bucket set up, you'll need to get your S3 credentials to use in your app.
103110
1041111 . Click on your username in the top right corner of the AWS console and select ` Security Credentials `
105- <Image src = { username } alt = " username" loading = " lazy" />
112+ <Image src = { username } alt = " username" loading = " lazy" />
1061132 . Scroll down to the ` Access keys ` section
1071143 . Click on ` Create Access Key `
1081154 . Select the ` Application running on an AWS service ` option and create the access key
109- <Image src = { keys } alt = " keys" loading = " lazy" />
116+ <Image src = { keys } alt = " keys" loading = " lazy" />
1101175 . Copy the ` Access key ID ` and ` Secret access key ` and paste them in your ` src/app/.env.server ` file:
111118``` sh
112119 AWS_S3_IAM_ACCESS_KEY=ACK...
0 commit comments