Clustering with Amazon AWS S3¶
When setting up clustering, you can use Amazon AWS S3 as a binary handler, meaning AWS S3 will be used to store binary files.
Before you start, you should be familiar with the clustering documentation.
Set up AWS S3 account¶
- Go to https://aws.amazon.com/ and create an account. An existing Amazon account can be used.
- Choose a region.
The example below uses EU (Ireland):
- Create a bucket in your chosen region and make note of the bucket name: http://docs.aws.amazon.com/AmazonS3/latest/gsg/CreatingABucket.html.
- Go to the IAM Management Console and create a user. See http://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html.
- Then create a group and assign the user to the group.
- Assign policies to the group. The
AmazonS3FullAccesspolicy gives read/write access to your bucket.
- Still in the IAM console, view the user you created. Click the "Security credentials" tab.
- Click "Create access key" and make note of the "Access key ID" and the "Secret access key". The secret key cannot be retrieved again after the key has been created, so don't lose it. (However, you can create new keys if needed.)
Set up eZ Platform for AWS S3¶
In your eZ Platform root directory, run
php composer.phar require league/flysystem-aws-s3-v3.
In your eZ Platform configuration, e.g.
app/config/config.yml, set up the AWS S3 client:
1 2 3 4 5 6 7 8 9 10
services: amazon.s3_client: class: Aws\S3\S3Client arguments: - version: latest region: eu-west-1 # The region string of your chosen region credentials: key: ABCDEF... # Your AWS key ID secret: abc123... # Your AWS secret key
In the same eZ Platform configuration, set up the Flysystem adapter that uses the S3 client:
1 2 3 4 5 6 7
oneup_flysystem: adapters: aws_s3_adapter: awss3v3: client: amazon.s3_client bucket: my-bucket # Your bucket name prefix: '%database_name%'
In the same place, set up the binary data handler for the S3 adapter:
1 2 3 4 5
ez_io: binarydata_handlers: aws_s3: flysystem: adapter: aws_s3_adapter
aws_s3 is an arbitrary handler identifier that is used in the config block below.
You can configure multiple handlers.
For example, you could configure one called
gcloud_storage for a third-party (community-supported)
Google Cloud Storage adapter.
In your eZ Platform system settings, e.g.
app/config/ezplatform.yml, enable the binary data handler:
1 2 3 4 5 6 7
ezpublish: system: default: io: binarydata_handler: aws_s3 # Also remember to use DFS for metadata_handler to avoid expensive lookups to S3 (see Clustering guide) # metadata_handler: dfs
Clear all caches and reload, and that's it.