Note that when you create a bucket it is located in a specific region. The full list of regions is available here.
composer require async-aws/simple-s3
An example service definition of the AsyncAws\SimpleS3\SimpleS3Client
:
services:
acme.async_aws_s3.client:
class: AsyncAws\SimpleS3\SimpleS3Client
arguments:
- region: '%amazon_s3.region%'
accessKeyId: '%amazon_s3.key%'
accessKeySecret: '%amazon_s3.secret%/K7MDENG/bPxRfiCYEXAMPLEKEY'
service_id
The service id of theAsyncAws\SimpleS3\SimpleS3Client
to use. (required)bucket_name
The name of the S3 bucket to use. (required)detect_content_type
Auto detect the content type. (default false)options
A list of additional options passed to the adapter.create
Whether to create the bucket if it doesn't exist. (default false)directory
A directory to operate in. (default '') This directory will be created in the root of the bucket and all files will be read and written there.acl
Default ACL to apply to the objects
Once the service is set up use its key as the service_id
in the gaufrette configuration:
# app/config/config.yml
knp_gaufrette:
adapters:
profile_photos:
async_aws_s3:
service_id: 'acme.async_aws_s3.client'
bucket_name: 'images'
detect_content_type: true
options:
directory: 'profile_photos'