Skip to content

Commit 98db9a7

Browse files
authored
Merge pull request #33 from micahmills/s3-instructions
S3 setup instructions
2 parents cd68830 + e566129 commit 98db9a7

File tree

2 files changed

+125
-2
lines changed

2 files changed

+125
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Need help or have a question? Join the D.T Forum: https://community.disciple.too
1212

1313
Provide the ability to store/retrieve all storage content within 3rd party object storage services; offering greater security.
1414

15-
## Security
15+
## Security
1616
Keep your files in a private S3 Bucket, protected from being findable from the web. This integration with Disciple.Tools creates short lived links (24 hours) to display images.
1717

1818
## API
@@ -33,7 +33,7 @@ DT_Storage::upload_file( string $key_prefix = '', array $upload = [], string $ex
3333

3434
- The following connection types (3rd Party Object Storage Services) are currently supported:
3535
- [BackBlaze](https://www.backblaze.com/) (Recommened) - See our [BackBlaze setup notes](https://disciple.tools/docs/storage/#backblaze)
36-
- [AWS S3](https://aws.amazon.com/s3/)
36+
- [AWS S3](https://aws.amazon.com/s3/) - See AWS S3 setup instructions [here](/SETUP_AWS_S3.md)
3737
- [MinIO](https://min.io/)
3838

3939

SETUP_AWS_S3.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
## ✅ AWS S3 Setup for Disciple.Tools Storage Plugin
2+
3+
### 1. Create an S3 Bucket
4+
5+
1. Go to the [AWS S3 Console](https://console.aws.amazon.com/s3/).
6+
2. Click **“Create bucket”**.
7+
3. Set:
8+
9+
* **Bucket name**: e.g., `dt-storage`
10+
* **Region**: Choose your preferred AWS region
11+
4. Under **Block Public Access settings**, leave all boxes **checked** (recommended) – files will be private by default.
12+
5. Leave **Object Lock** unchecked (disabled by default).
13+
6. Click **Create bucket**.
14+
15+
---
16+
17+
### 2. Set CORS Configuration
18+
19+
1. Go to the **Permissions** tab in the bucket.
20+
2. Scroll to **Cross-origin resource sharing (CORS)**.
21+
3. Click **Edit** and paste the following JSON:
22+
23+
```json
24+
[
25+
{
26+
"AllowedHeaders": [
27+
"*"
28+
],
29+
"AllowedMethods": [
30+
"GET",
31+
"PUT",
32+
"POST",
33+
"DELETE",
34+
"HEAD"
35+
],
36+
"AllowedOrigins": [
37+
"https://*.YOURDTDOMAIN.com"
38+
],
39+
"ExposeHeaders": [
40+
"ETag",
41+
"x-amz-request-id",
42+
"x-amz-id-2"
43+
],
44+
"MaxAgeSeconds": 3000
45+
}
46+
]
47+
```
48+
49+
> ℹ️ Note: AWS does **not support** wildcards (`"*"`) in `ExposeHeaders`. Each header must be listed explicitly.
50+
> Replace `YOURDTDOMAIN` with your actual Disciple.Tools domain.
51+
52+
---
53+
54+
### 4. Create an IAM User
55+
56+
1. Go to the [IAM Console](https://console.aws.amazon.com/iam/).
57+
2. Click **Users > Add user**.
58+
3. Set:
59+
60+
* **User name**: e.g., `dt-storage-user`
61+
4. When prompted for the **use case**, select:
62+
63+
> **Application running outside AWS**
64+
65+
5. Click **Next: Permissions**.
66+
67+
---
68+
69+
### 5. Create and Attach a Custom Policy
70+
71+
1. Click **Attach policies directly > Create policy**.
72+
2. In the **JSON** tab, paste:
73+
74+
```json
75+
{
76+
"Version": "2012-10-17",
77+
"Statement": [
78+
{
79+
"Effect": "Allow",
80+
"Action": [
81+
"s3:GetObject",
82+
"s3:PutObject",
83+
"s3:DeleteObject"
84+
],
85+
"Resource": "arn:aws:s3:::dt-storage/*"
86+
},
87+
{
88+
"Effect": "Allow",
89+
"Action": "s3:ListBucket",
90+
"Resource": "arn:aws:s3:::dt-storage"
91+
}
92+
]
93+
}
94+
```
95+
96+
> Replace `dt-storage` with your actual bucket name.
97+
98+
3. Click **Next**, give the policy a name (e.g., `DT_S3_Access`), and **create the policy**.
99+
4. Go back to the user setup, click **Refresh**, and select the new policy.
100+
5. Complete the user creation.
101+
102+
---
103+
104+
### 6. Save Access Credentials
105+
106+
Once the IAM user is created:
107+
* Click the user name to view details.
108+
* Under the **Summary** box you will see and Access Key or a button that says **Create access key** to click.
109+
* Copy the **Access Key ID** and **Secret Access Key** ('if you do not copy the secret key now, you will not be able to see it again').
110+
* Store them securely (e.g., password manager).
111+
112+
---
113+
114+
### 7. Configure Disciple.Tools Storage Plugin
115+
116+
In the Disciple.Tools Storage plugin settings:
117+
118+
* **Storage Type**: AWS S3
119+
* **Bucket Name**: `dt-storage` (or your bucket name)
120+
* **Access Key ID**: From IAM user
121+
* **Secret Access Key**: From IAM user
122+
* **Region**: Match the region you selected for the bucket (e.g., `us-east-1`)
123+
* **Endpoint**: the endpoint URL will be in the formate https:/<bucket-name>/s3.<region>.amazonaws.com (IE `https://dt-storage.s3.us-east-1.amazonaws.com` - replace `dt-storage` with your bucket name and `us-east-1` with you S3 bucket region).

0 commit comments

Comments
 (0)