s3-config.yml builds an Aws\S3\S3Client and registers an S3Template bean, so you can talk to multiple buckets, regions, or accounts from the same service. If you already use the SQS module, the configuration patterns here, like named connections and IAM-role credentials, will feel familiar.
Setup
Require the modules package with Composer (it pulls inaws/aws-sdk-php):
configFile is a file path relative to your config directory or an absolute path.
s3-config.yml
Each entry unders3 is a named connection. Only name, region, and version are mandatory; omit credentials to use IAM roles or the default credential chain.
endpoint to talk to an S3-compatible store instead of AWS.
Autowired services
S3Template is the primary service for object operations. The first registered template is the default bean; refer to any other connection by its name:
S3Template exposes the full AWS S3 API through magic methods. Every method accepts the same associative-array parameters as the AWS SDK for PHP client and returns an Aws\Result. Common operations include putObject, getObject, headObject, deleteObject, deleteObjects, listObjectsV2, copyObject, createBucket, deleteBucket, headBucket, listBuckets, bucket/object ACLs, versioning, lifecycle, CORS, tagging, and multipart uploads.
Connection properties
Any other S3Client configuration option may be set alongside these.
Using IAM roles (no keys required)
When your application runs on AWS infrastructure (EKS, EC2, Lambda, ECS, and so on), you do not need to specifycredentials. The AWS SDK automatically picks up the IAM role through the default credential chain:
eks.amazonaws.com/role-arn: arn:aws:iam::123456789:role/my-s3-role) and omit the credentials block.