|
| 1 | +--- |
| 2 | +i18nReady: true |
| 3 | +title: "@studiocms/s3" |
| 4 | +type: integration |
| 5 | +catalogEntry: studiocms-s3 |
| 6 | +description: "StudioCMS S3 Storage Manager plugin, Provides AWS S3 Storage Support for StudioCMS." |
| 7 | +sidebar: |
| 8 | + badge: |
| 9 | + text: NEW |
| 10 | + variant: success |
| 11 | +--- |
| 12 | + |
| 13 | +import { PackageManagers } from 'starlight-package-managers' |
| 14 | +import { Steps } from '@astrojs/starlight/components'; |
| 15 | + |
| 16 | +StudioCMS S3 Storage Manager plugin, Provides AWS S3 Storage Support for StudioCMS. This plugin allows you to use Amazon S3 or any S3-compatible storage service as the backend for storing files in your StudioCMS application. |
| 17 | + |
| 18 | +## Usage |
| 19 | + |
| 20 | +<Steps> |
| 21 | + |
| 22 | +1. Install the package using the following command: |
| 23 | + |
| 24 | + <PackageManagers type='add' pkg='@studiocms/storage-s3' /> |
| 25 | + |
| 26 | +2. Add this plugin in your StudioCMS config. (`studiocms.config.mjs`) |
| 27 | + |
| 28 | + ```ts twoslash title="studiocms.config.mjs" {5} |
| 29 | + import { defineStudioCMSConfig } from 'studiocms/config'; |
| 30 | + import s3Storage from '@studiocms/storage-s3'; |
| 31 | + |
| 32 | + export default defineStudioCMSConfig({ |
| 33 | + storageManager: s3Storage() |
| 34 | + }); |
| 35 | + ``` |
| 36 | + |
| 37 | +3. Configure the required environment variables in your `.env` file: |
| 38 | + |
| 39 | + ```sh title=".env" |
| 40 | + CMS_S3_PROVIDER=AWS |
| 41 | + CMS_S3_REGION=us-east-1 |
| 42 | + CMS_S3_ENDPOINT= # Leave empty for AWS |
| 43 | + CMS_S3_ACCESS_KEY_ID=your_access_key |
| 44 | + CMS_S3_SECRET_ACCESS_KEY=your_secret_key |
| 45 | + CMS_S3_BUCKET_NAME=your_bucket_name |
| 46 | + CMS_S3_FORCE_PATH_STYLE=false |
| 47 | + # CMS_S3_PUBLIC_ENDPOINT= # Optional: Custom public endpoint for accessing files |
| 48 | + ``` |
| 49 | + |
| 50 | +</Steps> |
| 51 | + |
| 52 | +## Environment Variable Examples |
| 53 | + |
| 54 | +### AWS |
| 55 | + |
| 56 | +```sh title=".env" |
| 57 | +CMS_S3_PROVIDER=AWS |
| 58 | +CMS_S3_REGION=us-east-1 |
| 59 | +CMS_S3_ENDPOINT= # Leave empty for AWS |
| 60 | +CMS_S3_ACCESS_KEY_ID=your_access_key |
| 61 | +CMS_S3_SECRET_ACCESS_KEY=your_secret_key |
| 62 | +CMS_S3_BUCKET_NAME=your_bucket_name |
| 63 | +CMS_S3_FORCE_PATH_STYLE=false |
| 64 | +CMS_S3_PUBLIC_ENDPOINT= # Optional: Custom public endpoint for accessing files |
| 65 | +``` |
| 66 | + |
| 67 | +### Cloudflare R2 |
| 68 | + |
| 69 | +```sh title=".env" |
| 70 | +CMS_S3_PROVIDER=Cloudflare R2 |
| 71 | +CMS_S3_REGION=auto |
| 72 | +CMS_S3_ENDPOINT=https://your-account-id.r2.cloudflarestorage.com |
| 73 | +CMS_S3_ACCESS_KEY_ID=your_r2_access_key |
| 74 | +CMS_S3_SECRET_ACCESS_KEY=your_r2_secret_key |
| 75 | +CMS_S3_BUCKET_NAME=your_bucket_name |
| 76 | +CMS_S3_FORCE_PATH_STYLE=false |
| 77 | +CMS_S3_PUBLIC_ENDPOINT= # Optional: Custom public endpoint for accessing files |
| 78 | +``` |
| 79 | + |
| 80 | +### DigitalOcean Spaces |
| 81 | + |
| 82 | +```sh title=".env" |
| 83 | +CMS_S3_PROVIDER=DigitalOcean Spaces |
| 84 | +CMS_S3_REGION=nyc3 |
| 85 | +CMS_S3_ENDPOINT=https://nyc3.digitaloceanspaces.com |
| 86 | +CMS_S3_ACCESS_KEY_ID=your_spaces_key |
| 87 | +CMS_S3_SECRET_ACCESS_KEY=your_spaces_secret |
| 88 | +CMS_S3_BUCKET_NAME=your_space_name |
| 89 | +CMS_S3_FORCE_PATH_STYLE=false |
| 90 | +CMS_S3_PUBLIC_ENDPOINT= # Optional: Custom public endpoint for accessing files |
| 91 | +``` |
| 92 | + |
| 93 | +### Backblaze B2 |
| 94 | + |
| 95 | +```sh title=".env" |
| 96 | +CMS_S3_PROVIDER=Backblaze B2 |
| 97 | +CMS_S3_REGION=us-west-004 |
| 98 | +CMS_S3_ENDPOINT=https://s3.us-west-004.backblazeb2.com |
| 99 | +CMS_S3_ACCESS_KEY_ID=your_b2_key_id |
| 100 | +CMS_S3_SECRET_ACCESS_KEY=your_b2_application_key |
| 101 | +CMS_S3_BUCKET_NAME=your_bucket_name |
| 102 | +CMS_S3_FORCE_PATH_STYLE=false |
| 103 | +CMS_S3_PUBLIC_ENDPOINT= # Optional: Custom public endpoint for accessing files |
| 104 | +``` |
| 105 | + |
| 106 | +### MinIO |
| 107 | + |
| 108 | +```sh title=".env" |
| 109 | +CMS_S3_PROVIDER=MinIO |
| 110 | +CMS_S3_REGION=us-east-1 |
| 111 | +CMS_S3_ENDPOINT=http://localhost:9000 |
| 112 | +CMS_S3_ACCESS_KEY_ID=minioadmin |
| 113 | +CMS_S3_SECRET_ACCESS_KEY=minioadmin |
| 114 | +CMS_S3_BUCKET_NAME=your_bucket_name |
| 115 | +CMS_S3_FORCE_PATH_STYLE=true # Required for MinIO |
| 116 | +CMS_S3_PUBLIC_ENDPOINT= # Optional: Custom public endpoint for accessing files |
| 117 | +``` |
| 118 | + |
| 119 | +### Wasabi |
| 120 | + |
| 121 | +```sh title=".env" |
| 122 | +CMS_S3_PROVIDER=Wasabi |
| 123 | +CMS_S3_REGION=us-east-1 |
| 124 | +CMS_S3_ENDPOINT=https://s3.us-east-1.wasabisys.com |
| 125 | +CMS_S3_ACCESS_KEY_ID=your_wasabi_key |
| 126 | +CMS_S3_SECRET_ACCESS_KEY=your_wasabi_secret |
| 127 | +CMS_S3_BUCKET_NAME=your_bucket_name |
| 128 | +CMS_S3_FORCE_PATH_STYLE=false |
| 129 | +CMS_S3_PUBLIC_ENDPOINT= # Optional: Custom public endpoint for accessing files |
| 130 | +``` |
| 131 | + |
| 132 | +### Linode Object Storage |
| 133 | + |
| 134 | +```sh title=".env" |
| 135 | +CMS_S3_PROVIDER=Linode |
| 136 | +CMS_S3_REGION=us-east-1 |
| 137 | +CMS_S3_ENDPOINT=https://us-east-1.linodeobjects.com |
| 138 | +CMS_S3_ACCESS_KEY_ID=your_linode_key |
| 139 | +CMS_S3_SECRET_ACCESS_KEY=your_linode_secret |
| 140 | +CMS_S3_BUCKET_NAME=your_bucket_name |
| 141 | +CMS_S3_FORCE_PATH_STYLE=false |
| 142 | +CMS_S3_PUBLIC_ENDPOINT= # Optional: Custom public endpoint for accessing files |
| 143 | +``` |
0 commit comments