Additional menu

Get MemberPress today! Start getting paid for the content you create! Get MemberPress Now
  1. Home
  2. Knowledge Base
  3. Add-ons
  4. Protecting Files
  5. Amazon Web Services (AWS)
  6. Configuring & Troubleshooting our Amazon Web Services (AWS) Addon

Configuring & Troubleshooting our Amazon Web Services (AWS) Addon

This add-on is available in the Plus, Pro, and Elite editions of MemberPress.

Overview

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, and files and do many other things. Amazon S3 is one of the services offered by 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.

Back to the top

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:

Then you'll want to create a “Bucket” … which is basically like a folder:

Make sure your bucket names only contain *lowercase* letters, numbers, and dashes, and that they start & end 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 however you want:

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 Settings page.

To find your security credentials, follow these steps:

  1. Login to AWS Dashboard.
  2. At the top right, click on the profile dropdown (your username), and select the Security Credentials option.

  3. In the left sidebar, under the Access Management section, choose Users.

  4. Next, click Create User.

  5. On the user details page, add the username you want to use following the username formatting instructions. Click Next to proceed.

  6. Select the Attach Policies Directly option, and search for the AmazonS3ReadOnlyAccess policy.

  7. Check the box next to AmazonS3ReadOnlyAccess to select it. Click Next to save the policy permissions.
  8. At the bottom of the page, confirm the user creation by clicking the Create User button.

  9. Once you create a user, you'll be redirected back to the Users list. Here, you will see a banner with the View User button. Click it to open the user page. 

  10. To create access keys for your new user, click Create access key.

  11. Choose the Third-party service option.

  12. Check the box at the bottom to acknowledge the recommendation, and then click Next.

  13. Leave the Description Tag Value empty, and click the Create Access Key button.

  14. Now, you will see the Retreave access keys page. Your Access Key and Secret Keys will be displayed here. You will need to add this data into MemberPress AWS add-on settings.

  15. Please note that you will not be able to retrieve these keys later. Thus, it’s recommended that you save them as a file, so you can use them at any time. To do so, click the Download .csv file button.
  16. Click Done to exit the page.

Now you're ready to add the two AWS keys you created previously, to the AWS add-on settings:

  1. Log in to your site, and navigate to Dashboard > MemberPress > Settings > AWS tab.
  2. Add your Access Key and your Secret Key to the designated fields.

  3. Click Update Options to save changes.

Note: It's IMPORTANT to make sure that your buckets and the files in your buckets are not publicly accessible, as that would defeat any protection of direct access to those files.

Back to the top

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.Note: The shortcode will not display the unauthorized message. If you want to display the message wrap the aws shortcode in the mepr-active 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. If omitted, the default is “+5 minutes“.
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.

You can also use any of the shortcode attributes supported by WordPress video shortcodes here: https://wordpress.org/support/article/video-shortcode/

Implementing the shortcodes and their parameters:

As the Using MemberPress AWS section above outlines, you can use mepr-s3-url, mepr-s3-link, mepr-s3-audio & mepr-s3-video for the type of file followed by the src parameter to specify the URL of your file. The following is an example link for a file that uses all of the above parameters so you can see how they can be implemented:

[mepr-s3-link src="coolbucket/anothercoolfile.pdf" rule="123" expires="+10 minutes" target="new" download="force"]Download My E-Book[/mepr-s3-link]

Please remember that the target="new" option can only be used with this shortcode:

[mepr-s3-link]

Also, the download="force" works only for these shortcodes:

[mepr-s3-url]

and

[mepr-s3-link]

Back to the top

Considerations about Audio and Video

Since the underlying links to audio and video content displayed with these shortcodes 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 expiration 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 add-on now supports V4 signatures. These new signatures are more secure than the original way Amazon has signed expiring URLs but are computationally more complex, thus 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.

Back to the top

Was this article helpful?
computer girl

Get MemberPress today!

Start getting paid for the content you create.