diff --git a/docs/docs/self-host/cloud-storage/s3.md b/docs/docs/self-host/cloud-storage/s3.md index 3171eb8fd..829d78806 100644 --- a/docs/docs/self-host/cloud-storage/s3.md +++ b/docs/docs/self-host/cloud-storage/s3.md @@ -6,34 +6,76 @@ title: AWS S3 ### AWS S3 - - Step 1 : Create a S3 bucket - Login to [AWS console](https://aws.amazon.com/console/) - - Navigate to S3 under services - - Hit "Create Bucket" button on upper right corner - - Remove the check from "block all public access" checkbox(we need this in order to provide access to not-logged in users after OTP verification) - - Set bucket versioning and tags as per your requirements - - Hit "Create bucket" button -- Step 2 : Create IAM user and provide access to AWS bucket - - Search for "IAM" on the search bar in AWS console - - On IAM dashboard, click the number of users(count) under IAM resources table - - Hit "create user" button on the upper right corner of the page - - Enter the user name & click next - - Click create policy, search for S3 and provide the Read, Write & list permissions - - Click next and click "Create user" - - Step 3 : Generate Credentials - - Go to IAM/Users in AWS console - - Hit the hyperlink for the user created in the previous step - - Click the "Security credentials" tab - - Scroll down to "Access keys" and hit "Create access key" - - In the next step select "Application running outside AWS" - - Add a description tag if needed & hit "Create access key" + - Navigate to S3 under services. + ![Screenshot 2024-09-30 203247](https://github.com/user-attachments/assets/1a734349-1c1a-4f53-8582-7318c22911f5) + - Hit "Create Bucket" button on upper right corner. + ![Screenshot 2024-09-30 195246](https://github.com/user-attachments/assets/b036fa3b-20c4-4348-8697-68bcf2fd9de3) + - Now provide bucket name and don't change any other options scroll down and click on "Create Bucket" button. + ![Screenshot 2024-09-30 195603](https://github.com/user-attachments/assets/3fb1a591-fffd-4703-9b1f-9cb1edbdf7fe) + ![Screenshot 2024-09-30 195835](https://github.com/user-attachments/assets/a0b2be8a-a273-474d-88d5-614cb42de8dd) + - Click on name of bucket from list which we have just created. + - Now go to permission Tab and scroll down to botton. + ![Screenshot 2024-09-30 202035](https://github.com/user-attachments/assets/dbf44b05-370b-40f8-bfc1-fd2f8441da46) + - At the bottom you will see cross-origin resource sharign (cors) section click on "Edit" button. + ![Screenshot 2024-09-30 202057](https://github.com/user-attachments/assets/a9fb13b3-7a30-4c49-b3ea-6a30a2b7c357) + - Now paste below line of code and add origin url in AllowedOrigins array and click on "Save changes". + ``` + [ + { + "AllowedHeaders": [ + "*" + ], + "AllowedMethods": [ + "GET", + "PUT", + "POST" + ], + "AllowedOrigins": [ + "httpS://localhost:3001", + + ], + "ExposeHeaders": [ + "x-amz-server-side-encryption", + "x-amz-request-id", + "x-amz-id-2" + ], + "MaxAgeSeconds": 3000 + } + ] + ``` + - Once done go to "Properties" there you will see region of bucket e.g us-east-1 + - set bucktname as "DO_SPACE" in ENV. + - set region as "DO_REGION" in ENV. + - Replace region in this url s3.{region}.amazonaws.com and set it as "DO_ENDPOINT" in ENV. + - Replace bucketName and region in this url https://{bucketName}.s3.{region}.amazonaws.com and set us as "DO_BASEURL" in ENV. +- Step 2 : Create a aws policy + - Navigate to IAM under services + ![Screenshot 2024-09-30 200247](https://github.com/user-attachments/assets/8109d2bb-1afb-4407-b5cd-4886a070d5cc) + - Now click on "Polices" from left side "access management" menu. + - Hit "Create Policy" button on upper right corner. + ![Screenshot 2024-09-30 200939](https://github.com/user-attachments/assets/1b3b5608-9a84-477d-b46e-aaf884a73343) + - Search for S3 and Tick PutObject and GetObject from Action Allowed list. + ![Screenshot 2024-09-30 200537](https://github.com/user-attachments/assets/7168d261-abc4-4789-8e64-628c81c79e24) + ![Screenshot 2024-09-30 200607](https://github.com/user-attachments/assets/863f8e7c-74eb-4f1b-9ea5-41524ba249ca) + - provide policy name and hit on 'Create Policy". + ![Screenshot 2024-09-30 200808](https://github.com/user-attachments/assets/4db2ab95-14bb-4ea1-a9a3-821e20e70038) +- Step 3 : Create IAM user. + - Now click on "Users" from left side "access management" menu and then click on "Create User" button. + ![Screenshot 2024-09-30 201026](https://github.com/user-attachments/assets/1aa1f071-6291-457f-a514-970f511866cb) + - Provide username and click on Next button. + - Now select "Attach policies directly" from Permissions options. + ![Screenshot 2024-09-30 201731](https://github.com/user-attachments/assets/13c6d571-d3da-4259-8f04-8ec130d9091a) + - Now search policy in "Permission Policies" section which we have created in previous step. + ![Screenshot 2024-09-30 201742](https://github.com/user-attachments/assets/c2b1643d-e3e3-49ee-920b-641e7ff819f5) + - Now scroll down and Click on "Create User" Button. +- Step 4 : Generate Credentials + - Now Click on username form list which we have created in previous step. + - Click on "Create Access Key" from right corner. + ![Screenshot 2024-09-30 201850](https://github.com/user-attachments/assets/d25abe2f-0cfc-4cc0-a02c-6b9fc6559dd2) + - In the next step select "Application running outside AWS". + ![Screenshot 2024-09-30 201917](https://github.com/user-attachments/assets/f9b0cdb2-3718-4ae6-a4ba-68e144d1f4a1) - In the next step you will see "Access key" and "Secret Access key". Copy both the values. - - Set the value of "Access key" to "DO_ACCESS_KEY_ID" environment variable - - Set the value of "Secret Access key" to "DO_SECRET_ACCESS_KEY" environment variable -- Step 3 : Copy bucket credentials - - Visit "Amazon S3 -> Buckets" in aws console - - Click the bucket created in previous steps & visit the properties tab - - Under "Bucket overview" you will find the value of AWS region(for ex. ap-south-1). Set that value to env variable "DO_REGION" - - You can create the value for "DO_ENDPOINT" env variable by appending the region value to amazonaws.com (for ex. s3.ap-south-1.amazonaws.com) - - You can create the value for "DO_BASEURL" by adding the bucketname in front of the endpoint value(for ex. https://bucketname.s3.ap-south-1.amazonaws.com) - + - Set the value of "Access key" to "DO_ACCESS_KEY_ID" environment variable. + - Set the value of "Secret Access key" to "DO_SECRET_ACCESS_KEY" environment variable. Visit below link if you face any issues while following the above instructions - - https://repost.aws/knowledge-center/create-access-key