Extension:AWS

The AWS extension allows MediaWiki to use Amazon S3 (or any compatible API, such as Apache CloudStack or Digital Ocean Spaces) instead of the local  directory to store a wiki's uploaded files.

Why is this needed
When images are in S3:
 * 1) Amazon EC2 instance which runs MediaWiki doesn't contain any important data and can be created/destroyed by Autoscaling.
 * 2) Visitors download images directly from Amazon S3 (which is fast), not from Amazon EC2 (where network performance depends on instance type, etc.).

Alternatives
Instead of using Amazon S3 (and this extension), you can create an Amazon EFS drive and mount it to. It's recommended for small wikis.

Installation
For modern versions of MediaWiki (1.35+), use the following instruction:


 * 1) Download the extension:
 * 2) Move the AWS directory to the "extensions" directory of your MediaWiki, e.g.   (assuming MediaWiki is in  ).
 * 3) Create the file   with the following contents:
 * 4) Run   from   (to download dependencies). If you don't have Composer installed, see Composer for how to install it.
 * 5) Create an S3 bucket for images, e.g..
 * Note: this name will be seen in URL of images.
 * 1) Authorize MediaWiki to access Amazon S3:
 * 2) If your EC2 instance has an IAM instance profile (recommended), copy everything from "Needed IAM permissions" (see below) to inline policy of the IAM role. See https://console.aws.amazon.com/iam/home#/roles
 * 3) If your EC2 instance doesn't have an IAM profile, obtain key/secret for AWS API. You'll need to write it in LocalSettings.php (see below).
 * 4) Modify LocalSettings.php (see below).
 * 1) If your EC2 instance doesn't have an IAM profile, obtain key/secret for AWS API. You'll need to write it in LocalSettings.php (see below).
 * 2) Modify LocalSettings.php (see below).

See https://github.com/edwardspec/mediawiki-aws-s3/blob/master/README.md for more details.

Installation for older versions of MediaWiki
See Extension:AWS/Installation for 1.27-1.34. These versions may still receive security fixes (if any), but not new features.

Step 2: needed IAM permissions
Visit the IAM Management Console - https://console.aws.amazon.com/iam/home - and add "Inline policy" to the IAM role of your Webserver.

Inline policy should contain (within the Statement array, as in this example) the following permissions (replace  with the name of your S3 bucket, e.g.  ):

Debug log
For troubleshooting purposes, you can enable the debug log:

This log records every S3 operation (GetObject, PutObject, etc.), even if they were successful, plus the error messages if they failed. This can help to notice some misconfigurations (wrong bucket name, etc.).

The log can be quite large, so it should be disabled when you don't need it anymore.

Bug reports

 * https://github.com/edwardspec/mediawiki-aws-s3/issues