Overview
S3M requires AWS credentials and an S3 bucket to handle multipart uploads. This guide walks you through setting up your AWS environment and configuring the necessary permissions.Configure Environment Variables
Add the following AWS credentials to your
.env file:These environment variables are automatically loaded from the
config/s3m.php configuration file.Create S3 Bucket
Create an S3 bucket in your AWS account:
- Log in to the AWS S3 Console
- Click “Create bucket”
- Enter a unique bucket name
- Select your preferred region
- Configure bucket settings (versioning, encryption, etc.)
- Click “Create bucket”
Configure Bucket Lifecycle
Set up a lifecycle rule to automatically delete temporary files:
- Navigate to your bucket in the S3 Console
- Go to “Management” tab
- Click “Create lifecycle rule”
- Name: “Delete temporary uploads”
- Apply to prefix:
tmp/ - Enable “Expire current versions of objects”
- Set to 1 day after object creation
- Save the rule
This automatically cleans up incomplete uploads in the
/tmp/ directory after 24 hours.IAM Permissions
Your AWS IAM user or role needs the following S3 permissions:S3 Configuration Reference
The S3 configuration is defined inconfig/s3m.php:
Configuration Parameters
AWS Access Key ID for authentication
AWS Secret Access Key for authentication
AWS Session Token for temporary credentials (optional)
AWS region where your S3 bucket is located (e.g.,
us-east-1)Name of the S3 bucket for uploads
Custom URL for accessing uploaded files (useful for CDN integration)
Custom S3 endpoint for S3-compatible services (e.g., MinIO, DigitalOcean Spaces)
Use path-style endpoint instead of virtual-hosted-style (required for some S3-compatible services)