Amazon S3
- Amazon S3 Configuration for MediaWiki
This article details configuring Amazon S3 for use with your MediaWiki installation. Utilizing S3 provides scalable and cost-effective storage for your wiki’s files, particularly images, thumbnails, and other uploads. This guide assumes you have an existing AWS account and basic familiarity with the AWS Management Console.
Prerequisites
Before you begin, you’ll need the following:
- An Amazon Web Services (AWS) account.
- An IAM user with appropriate permissions to access S3. This user should have permissions for `s3:ListBucket`, `s3:GetObject`, `s3:PutObject`, and `s3:DeleteObject`.
- The AWS Access Key ID and Secret Access Key for the IAM user.
- A designated S3 bucket to store your MediaWiki files.
Creating an S3 Bucket
1. Log in to the AWS Management Console. 2. Navigate to the S3 service. 3. Click "Create bucket". 4. Enter a globally unique bucket name. Be mindful of naming conventions. 5. Choose a region geographically close to your servers for lower latency. 6. Configure bucket settings as needed. For most MediaWiki deployments, default settings are sufficient initially. Consider enabling versioning for data recovery. 7. Review and create the bucket.
Configuring MediaWiki for S3
You’ll need to modify your `LocalSettings.php` file to integrate with S3. Locate this file in your MediaWiki installation directory. Add the following configuration options:
```php $wgStorageRepositories = [
'local' => [ 'class' => 'LocalRepo', 'cost' => 1.0 ], 's3' => [ 'class' => 'S3Repo', 'name' => 'S3 Storage', 'bucket' => 'your-bucket-name', // Replace with your bucket name 'region' => 'your-bucket-region', // Replace with your bucket region (e.g., us-east-1) 'key' => 'YOUR_ACCESS_KEY', // Replace with your AWS Access Key ID 'secret' => 'YOUR_SECRET_KEY', // Replace with your AWS Secret Access Key 'cost' => 0.5, // Relative cost of storage 'public' => false, // Whether files are publicly accessible 'path' => '/MediaWiki/', // Optional path within the bucket 'endpoint' => null //Optional custom endpoint ]
];
$wgRepoGroup = 's3'; // Set S3 as the primary repository ```
Replace the placeholder values with your actual bucket name, region, access key, and secret key. Ensure the region matches the one you selected during bucket creation.
Important Configuration Options
Here is a breakdown of the critical configuration options available for the `S3Repo` class:
Option | Description | Default Value |
---|---|---|
`bucket` | The name of your S3 bucket. | Required |
`region` | The AWS region where your bucket is located. | Required |
`key` | Your AWS Access Key ID. | Required |
`secret` | Your AWS Secret Access Key. | Required |
`cost` | A relative cost factor for storage. Used for repository prioritization. | `1.0` |
`public` | Whether files are publicly accessible. Set to `true` for public wikis; otherwise, `false`. | `false` |
`path` | An optional path within the bucket to store MediaWiki files. | `` |
`endpoint` | A custom endpoint URL for S3, if necessary. | `null` |
Permissions and Security
Properly configuring IAM permissions is crucial. Granting excessive permissions can compromise your AWS account. The IAM user used by MediaWiki should have only the necessary permissions to interact with the S3 bucket. Consider using least privilege principles.
Here's a sample IAM policy snippet:
```json {
"Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:GetObject", "s3:PutObject", "s3:DeleteObject" ], "Resource": [ "arn:aws:s3:::your-bucket-name", "arn:aws:s3:::your-bucket-name/*" ] } ]
} ```
Remember to replace `your-bucket-name` with your actual bucket name.
Troubleshooting
If you encounter issues, consider the following:
- Verify your AWS Access Key ID and Secret Access Key are correct.
- Ensure the IAM user has the necessary permissions.
- Check the bucket name and region are accurate.
- Review the MediaWiki error logs for detailed error messages.
- Confirm your server has network connectivity to the S3 endpoint.
S3 Performance Considerations
Optimizing S3 performance is essential for a responsive wiki. Consider these factors:
Factor | Description | Recommendation |
---|---|---|
Region Selection | Choosing a region close to your servers reduces latency. | Select the geographically closest region. |
Object Size | S3 performance can vary based on object size. | For frequently accessed small files, consider combining them into larger archives. |
Request Rate | S3 has request rate limits. | Implement caching mechanisms in your MediaWiki configuration. |
Data Transfer Costs | Transferring data between regions can incur costs. | Minimize cross-region data transfers. |
Advanced Configuration
For more advanced scenarios, explore these options:
- **S3 Transfer Acceleration:** Can improve upload and download speeds.
- **S3 Intelligent-Tiering:** Automatically moves data between different storage tiers based on access patterns, optimizing costs.
- **Custom S3 Endpoint:** Useful for using private S3 endpoints or proxy servers.
- **Object Lifecycle Management:** Automate the deletion of older files to reduce storage costs and maintain data retention policies.
S3 Bucket Policies
You can further refine access control using S3 bucket policies. These allow you to specify conditions for accessing your bucket. For example, you can restrict access based on IP address or user agent. Refer to the AWS documentation for detailed information.
Related Pages
- Manual:Configuring file uploads
- Extension:S3 (for more advanced integration)
- Help:Images
- Configuration
- Security
- AWS Documentation
- IAM Roles
- File Uploads
- MediaWiki Storage
- File Repositories
- Local Settings
- Maintenance
- Performance Tuning
Intel-Based Server Configurations
Configuration | Specifications | Benchmark |
---|---|---|
Core i7-6700K/7700 Server | 64 GB DDR4, NVMe SSD 2 x 512 GB | CPU Benchmark: 8046 |
Core i7-8700 Server | 64 GB DDR4, NVMe SSD 2x1 TB | CPU Benchmark: 13124 |
Core i9-9900K Server | 128 GB DDR4, NVMe SSD 2 x 1 TB | CPU Benchmark: 49969 |
Core i9-13900 Server (64GB) | 64 GB RAM, 2x2 TB NVMe SSD | |
Core i9-13900 Server (128GB) | 128 GB RAM, 2x2 TB NVMe SSD | |
Core i5-13500 Server (64GB) | 64 GB RAM, 2x500 GB NVMe SSD | |
Core i5-13500 Server (128GB) | 128 GB RAM, 2x500 GB NVMe SSD | |
Core i5-13500 Workstation | 64 GB DDR5 RAM, 2 NVMe SSD, NVIDIA RTX 4000 |
AMD-Based Server Configurations
Configuration | Specifications | Benchmark |
---|---|---|
Ryzen 5 3600 Server | 64 GB RAM, 2x480 GB NVMe | CPU Benchmark: 17849 |
Ryzen 7 7700 Server | 64 GB DDR5 RAM, 2x1 TB NVMe | CPU Benchmark: 35224 |
Ryzen 9 5950X Server | 128 GB RAM, 2x4 TB NVMe | CPU Benchmark: 46045 |
Ryzen 9 7950X Server | 128 GB DDR5 ECC, 2x2 TB NVMe | CPU Benchmark: 63561 |
EPYC 7502P Server (128GB/1TB) | 128 GB RAM, 1 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (128GB/2TB) | 128 GB RAM, 2 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (128GB/4TB) | 128 GB RAM, 2x2 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (256GB/1TB) | 256 GB RAM, 1 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (256GB/4TB) | 256 GB RAM, 2x2 TB NVMe | CPU Benchmark: 48021 |
EPYC 9454P Server | 256 GB RAM, 2x2 TB NVMe |
Order Your Dedicated Server
Configure and order your ideal server configuration
Need Assistance?
- Telegram: @powervps Servers at a discounted price
⚠️ *Note: All benchmark scores are approximate and may vary based on configuration. Server availability subject to stock.* ⚠️