Skip to main content
Winter S3 is a module that provides easy configuration and access to S3 object storage (or S3-compatible services) from Winter Boot applications. Each named entry in 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 in aws/aws-sdk-php):
Enable the module in your application.yml:
configFile is a file path relative to your config directory or an absolute path.

s3-config.yml

Each entry under s3 is a named connection. Only name, region, and version are mandatory; omit credentials to use IAM roles or the default credential chain.
Set 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 specify credentials. The AWS SDK automatically picks up the IAM role through the default credential chain:
For EKS, annotate your Kubernetes ServiceAccount with the role ARN (eks.amazonaws.com/role-arn: arn:aws:iam::123456789:role/my-s3-role) and omit the credentials block.
For AWS-managed queues alongside object storage, see the SQS module.