These are the docs for Directus 8, a legacy version of the platform. If you're looking for the current Directus 9 documentation, go here: https://docs.directus.io
Storage Adapters allow you to save Directus files anywhere. The default storage adapter is the API server's filesystem, but you can also use the included adapter for AWS-S3 or create your own.
- Filesystem – Store files on the API server's filesystem
- AWS S3 – Store files on Amazon's Simple Storage Service
- Rackconnect – Store files on Rackspace's storage solution
You can change your project's default storage adapter within the API configuration.
Using AWS S3
First you need to install the adapter (not installed by default, to keep dependencies small).
If are using the Directus Suite version, this version is missing the
composer.json file. Follow these steps before installing the AWS S3 storage to recreate
composer.json and update the composer autoloader. If there's already a
composer require league/flysystem-aws-s3-v3
Then simply set the following into your configuration file (by default
'storage' => [ 'adapter' => 's3', 'key' => 'your-aws-key', 'secret' => 'your-aws-secret', 'bucket' => 'your-aws-bucket-name', 'version' => 'latest', 'region' => 'us-east-1', 'options' => [ 'ACL' => 'public-read', 'CacheControl' => 'max-age=604800' ], 'endpoint' => 's3-endpoint || http://s3-<region>.amazonaws.com', 'root' => '/', 'thumb_root' => '/thumbnails', 'root_url' => '/', ]
rootoption indicates the root path of all uploads.
thumb_rootoption indicates the root path where all the thumbnails are going to be stored.
root_urlis the URL to access all the files stored in the bucket, such as your bucket url, or AWS CloudFront URL.
endpointis the url which s3 is accessed usually in the format of
secretis created by IAM access keys
Read more about the ACL permissions here: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl.
If you want to set any new uploaded files to be publicly readable, you should set the
public-read, otherwise all these permission will follow you default S3 bucket permissions.
Using AWS S3 with custom endpoint
If you want to connect a custom AWS S3 endpoint (for example a minio server), you can (additionally to the the configuration above) add:
'storage' => [ 'adapter' => 's3', // ... 'endpoint' => 'http://minio.acme.com' ]
Files & Structure