We rebuilt our website from scratch and are still updating some extensions and pages. Having a problem? Sign in and open a support ticket or contact us.
JoomBoost

Amazon S3

Amazon S3 is Amazon Web Services' file storage. The JoomVideos - CDN AmazonS3 plugin moves the files of your uploaded videos from your server to an S3 bucket. Visitors then load the videos and thumbnails straight from Amazon, which saves disk space and bandwidth on your own server.

What you need

  • An AWS account and an S3 bucket.
  • An access key (access key ID and secret access key) of an IAM user that may use that bucket.
  • The PHP curl extension on your server.
  • A way to run the transfer: a cron job with PHP CLI (recommended) or a URL cron job.

What is moved, and when

Nothing is moved at upload time. The transfer runs only when you start it, see Run the transfer. Each run:

  1. Takes every published video whose source is a file on your server. Videos from YouTube and other links, streams and embed codes are skipped.
  2. Skips a video that still has queued jobs in Processes. Let processing finish first.
  3. Uploads all the video's files to the bucket: the original, the converted sizes and the thumbnails. They keep their path, for example media/com_joomvideos/videos/12/720/.... A file that is already in the bucket with the same size is not sent again.
  4. Skips any file larger than 500 MB. That video then stays on your server.
  5. When every file of a video is in the bucket, points the video and its files to the S3 addresses and deletes the local folders of that video (media/com_joomvideos/videos/<id> and media/com_joomvideos/img/videos/<id>).

Unpublished videos stay on your server until they are published and the next run picks them up.

Set up

1. Prepare the bucket in AWS

  1. Create a bucket, or use an existing one, in a region from the list in step 2 below.
  2. The plugin uploads every file with the public-read access setting (ACL), so the files can be watched without signing in. In the bucket's settings:
    • under Object Ownership, choose ACLs enabled;
    • under Block public access, turn off the blocks for ACLs.
  3. Create an IAM user with an access key. Allow it, for this bucket: list buckets, get the bucket location, list the bucket, put objects and put object ACLs. If the bucket does not exist yet, the plugin creates it, which also needs permission to create buckets.

2. Configure the plugin

  1. Go to System > Manage > Plugins, search for AmazonS3 and enable JoomVideos - CDN AmazonS3. It is installed disabled.
  2. Open it and fill in:
Setting What to enter
AWS Access Key The access key ID
AWS Secret Key The secret access key
AWS Bucket The bucket name
Default Region The region of the bucket, see below
Reduced Redundancy Yes stores the files in Amazon's Reduced Redundancy storage class. No by default

Default Region must match the bucket. These choices work:

Choice AWS region
US Standard US East (N. Virginia), us-east-1
US West (Northern California) us-west-1
US West (Oregon) us-west-2
Europe Standard Europe (Ireland), eu-west-1
Singapore ( Asia Pacific ) ap-southeast-1
Tokyo ( Asia Pacific ) ap-northeast-1

For a bucket in Ireland, choose Europe Standard, not Ireland ( Europe ): in 6.1.6 the Ireland ( Europe ) and South America (Sao Paulo) choices send the requests to the US East address, and Amazon refuses them. Buckets in other regions are not supported.

  1. Save.

3. Turn on the CDN in JoomVideos

Go to Components > JoomVideos > Options > Features, set CDN to AmazonS3 and save.

Run the transfer

php cli/joomvideos_process.php cdn

Run it from your site's folder over SSH to test, then add it as a cron job, for example once an hour:

0 * * * * /usr/bin/php /path/to/your/site/cli/joomvideos_process.php cdn

The command prints one line per file and per video: copied, already in the bucket, skipped and why, database updated, local files deleted.

URL

If you only have URL cron jobs:

https://www.example.com/index.php?option=com_joomvideos&task=cron.cdn&secretkey=YOUR_KEY

YOUR_KEY is the Cron Task Key in Options > Processing. Change the default key first, see FFmpeg. A web request can hit your host's time limit while large files upload, so prefer the CLI.

URLs served

After the transfer, the video and its files point to addresses like:

https://BUCKET.s3-us-west-2.amazonaws.com/media/com_joomvideos/videos/12/720/...

(https://BUCKET.s3.amazonaws.com/... for US Standard). The player loads the files from there. Protect local video files in Options > Features does not apply to these files: anyone with the address can open them.

Limits

  • There is no way back built in. The local copies are deleted after the transfer. Keep a backup of media/com_joomvideos before the first run.
  • Files over 500 MB are not transferred.
  • Only one bucket. Moving to another bucket or region later means copying the files in AWS and changing the addresses in the database yourself.
  • Videos keep playing from S3 only while the files stay public in the bucket.

If it does not work

  • Nothing happens when the command runs. Check that CDN is set to AmazonS3 in Options > Features and that the plugin is enabled.
  • "ERROR: AWS access information required". AWS Access Key or AWS Secret Key is empty.
  • "Failed to copy file". The key may not write to the bucket, the region is wrong, or the bucket does not allow ACLs. Check the bucket settings in step 1 and the region table.
  • "Bucket already exist in ... region". The bucket is in another region than Default Region. Set Default Region to the bucket's region.
  • "Video has queued processes". Run or delete the video's jobs in Processes first.
  • "is larger than 0.5GB so skipping". The file stays on your server.
  • Videos do not play after the transfer. Open one of the S3 addresses in a browser. "Access Denied" means the files are not public: check Block public access and the ACL settings.

All Extensions