MemberPress AWS

« MemberPress Users Manual

The MemberPress AWS Add-On will give you the ability to:

  1. Host private files on Amazon S3
  2. Provide expiring links to registered members with access to individual files
  3. Embed Video and Audio files on your WordPress pages & posts using the open source Media Element Player (works in Desktop and Mobile browsers)
  4. Protect your embedded Audio and Video files from being viewed by non-members

MemberPress AWS can be downloaded from here:
MemberPress Add-Ons

What is Amazon AWS?

Amazon Web Services (AWS) is a set of tools provided by Amazon to help people host websites, files and do many other things. Amazon S3 is one of the services offered in Amazon AWS ... it allows you to upload, host and protect files and be backed by the reliability, security and speed of Amazon.com! Amazon AWS is widely used by individuals, fortune 500 companies and every other type of entity in between.

You can sign up for Amazon AWS very easily -- it's pay by usage and quite inexpensive.

Uploading Your Files To Amazon S3

Once you've signed up and are accessing your AWS Management Console you can click on the S3 button here:

s3

Then you'll want to create a "Bucket" ... which is basically like a folder:

s3bucket

Make sure your bucket names only contain *lowercase* letters, numbers and dashes ... and that it starts & ends with a lowercase letter. You can read more about these restrictions on Amazon's AWS developer resource website.

Once your bucket is in place, you can click on it ... from within your bucket you can then upload files, create folders and generally organize your files how ever you want:

s3upload

Alternatively ... There are now some services & programs that connect with Amazon S3 ... a couple of these are Cyberduck (Mac only) and FTP2Cloud (similar to DropBox's interface).

Try to make sure that any of your folder names and files only contain uppercase letters, lowercase letters, numbers or dashes ... please try to avoid spaces & special characters in your folder and file names. While this isn't specifically forbidden by Amazon S3's guidelines, special characters (including spaces) have been known to interfere with MemberPress AWS's ability to work properly.

Retrieving Your Amazon Security Credentials

Before you can start using MemberPress AWS you have to enter the Amazon Security credentials associated with your account into your MemberPress website's Options page.

To get your security credentials, go to the upper right hand corner of your AWS management console, click your name and select "Security Credentials":

s3account

Then go down to the "Access Credentials" portion of the page, click "Create New Root Key":

new_root_key

Download the key file when prompted:

download_key_file

Don't lose this downloaded file, it is the only place you'll be able to get your secret key from here on out:

rootkey.csv

Now you're ready to paste these two keys into the AWS tab in MemberPress -> Options:

skitch-1

Using MemberPress AWS

Now that you've got MemberPress and the MemberPress AWS add-on installed, you can start using the following shortcodes in your pages, posts and custom post types:

A shortcode that displays an expiring url to your protected file:

[mepr-s3-url src="coolbucket/coolfile.zip"]

A shortcode that creates a link to an expiring url to your protected file:

[mepr-s3-link src="coolbucket/anothercoolfile.pdf"]Download My E-Book[/mepr-s3-link]

A shortcode that embeds a protected audio file (using an encoded Media Element Player and expiring urls):

[mepr-s3-audio src="coolbucket/coolaudiofile.mp3"]

A shortcode that embeds a protected video file (using an encoded Media Element Player and expiring urls):

[mepr-s3-video src="coolbucket/coolmp4s/coolvideofile.mp4"]

Shortcode Options

Common Options
These options are available for all of the MemberPress AWS shortcodes:

src: This is a way to identify the Amazon S3 bucket and path to the protected Amazon file. These values are formatted "<bucket>/<file path>" -- for example if I had an S3 bucket named 'mycoolzips' and I had a file within that bucket called 'funny.zip' and wanted to create a temporary link or embedded media resource then you'd have an src equal to 'mycoolzips/funny.zip' ...
rule: This identifies the id of the rule that should be used to determine whether or not to display the shortcode.
expires: The time that the amazon link will be valid. This can be any value that would be accepted by PHP's time functions. A good example would be "+5 minutes" for a link that expires within 5 minutes or "+30 seconds" for a link expiring in 30 seconds
target: Set to "new" to open links in a new tab. This option only applies to the mepr-s3-link shortcode.
download: Set to "force" to force the user's browser to download the file when they click the link instead of opening it in the browser. This option only applies to the mepr-s3-url and mepr-s3-link shortcodes.

mepr-s3-url
This shortcode is used to calculate and print out an Amazon S3 expiring link.

mepr-s3-link
This shortcode is used to calculate an Amazon S3 expiring link and display it as the href of a link. This shortcode needs to wrap the text you want displayed for this link.

mepr-s3-audio & mepr-s3-video
These shortcodes are used to embed protected audio and video files onto your pages and posts. Aside from the expire and rule attributes ... and the fact that the src attributes represent file paths for Amazon AWS S3 these shortcodes behave exactly like the audio and video shortcodes built-in to WordPress itself ... including the ability to include fallback video files to maximize compatibility across all browsers.

Considerations about Audio and Video

Since the underlying links to audio and video content displayed with these short tags are expiring links ... if any file lasts longer than the expiration time there can be issues with users scrubbing video forward or back.

When determining your expire time take these facts into account:

  1. The shorter the expiration of the links is the more chance there is for issues with the user experience ...
  2. The longer the expiration of the links is the more chance there is for users to download your video content.

AWS V4 Signatures

Recently Amazon AWS introduced a new way of "signing" expiring urls which they call V4 signatures. The MemberPress AWS addon now supports V4 signatures. These new signatures are more secure than the original way Amazon has signed expiring urls but are computationally more complex and so we still recommend you stay with the old signature formats if you can. Some newer Amazon AWS regions only support V4 signatures though. If you decide to use V4 signatures you'll need to be prepared to also supply MemberPress AWS with the AWS region that you're using.