This plugin provides an Amazon S3 integration for Craft CMS.
This plugin requires Craft CMS 3.1.5 or later.
You can install this plugin from the Plugin Store or with Composer.
Go to the Plugin Store in your project’s Control Panel and search for “Amazon S3”. Then click on the “Install” button in its modal window.
Open your terminal and run the following commands:
# go to the project directory
cd /path/to/my-project.test
# tell Composer to load the plugin
composer require craftcms/aws-s3
# tell Craft to install the plugin
./craft install/plugin aws-s3
To create a new asset volume for your Amazon S3 bucket, go to Settings → Assets, create a new volume, and set the Volume Type setting to “Amazon S3”.
Tip: The Base URL, Access Key ID, Secret Access Key, Subfolder, CloudFront Distribution ID, and CloudFront Path Prefix settings can be set to environment variables. See Environmental Configuration in the Craft docs to learn more about that.
Once you’ve created your Amazon S3 volume, you can override its bucket and/or region for an environment by adding two new environment variables:
# The name of the S3 bucket
S3_BUCKET=""
# The region the S3 bucket is in
S3_REGION=""
Then create a config/volumes.php
file that overrides your volume’s bucket
and region
settings to the values provided by these environment variables:
<?php
return [
'myVolumeHandle' => array_filter([
'bucket' => getenv('S3_BUCKET'),
'region' => getenv('S3_REGION'),
]),
];
Now any environments that have S3_BUCKET
and/or S3_REGION
environment variables defined will override the volume’s bucket
and region
settings.
### Using the automatic focal point detection
This plugin can use the AWS Rekognition service to detect faces in an image and automatically set the focal point accordingly. This requires the image to be either a jpg or a png file. To enable this feature, just turn it on the volume settings.
rekognition:DetectFaces
action to be allowed.