Updated on August 18, 2018
How to use S3Media Linksafe – Lite
Best follow the tabs below in the order of appearance for a smooth process. If you never setup your AWS bucket/distribution before, please read this pdf first: Setup-private-download-aws-console
Install like any other plugin on WordPress:
- Go to Plugins > Add New
- Select Upload
- Click the Browse button and locate the zip you downloaded.
- Click Install Now.
- After installation, click Activate plugin.
After install, you find the link to S3Media LinkSafe Lite on the lefthand pane in your admin panel of WordPress:
This will be used to set the Access keys and default options before you use the Link Wizard in the text editor of your posts/pages.
Click the S3Media LinkSafe Lite link in the lefthand pane of your admin panel to set your AWS keys and default settings. Here everything is filled in already, but we show you step by step how to do this:
All fields have a convenient hint button that gives a short explanation how to fill in the field correctly:
In the the first part of the options, you need to fill in the Access keys and Keypairs (the latter only if you plan to download distributions):
Getting the Access Keys
After you sign up for AWS, you must create access keys for the account. You can retrieve the access key ID from the Security Credentials page, but you cannot retrieve the secret access key. If the secret access key is lost or forgotten, you need to create new access keys. Go to the Security Credentials page and sign in:
Use your login and password to login. A new page opens with a popup box:
Select Continue to Security Credentials.
In the Access Keys section, click Create New Access Key:
When you have done that, save the Access Keys by downloading them:
Open the file and go to the window tab that shows the S3Media Stream – options, then paste that key into the S3 Access Key – field as shown below.
Then copy the Secret Key and paste it into the S3 Secret Key – field of the S3Media Stream Options. You recognize the secret key easily since it is much longer then the access key:
You can do the same with the Key Pairs of CloudFront. If you have not signed up yet with CloudFront, sign up here logging it with your existing account and follow the instructions, it is fixed in a minute.
NOTE: You do not need CloudFront if you do not plan to work with download distributions but it is a good idea for an international audience.
Getting the Keypairs
To set the Key Pairs, click on the tab CloudFront Key Pairs and click on Create New Key Pair:
You will be asked to safe the Private Key File:
Download the file to a safe place. Then copy the public key:
and paste it in the CloudFront Key Pair ID field of the S3Media LinkSafe options.
NOTE: Do not download the Public Key. It serves no purpose, just copy the string above that link.
Now, open the private key file. The file typically has a name like this: pk-xxxxxx.pem where xxxxx is the name of the public key. In the file you will see the private key displayed. Now, copy everything you see in the file, including the comments and paste it into the CloudFront Private Keyfile field. It should now look more or less like this:
If you forget to comments, it will not work. Make also sure that there are no spaces after each line.
The default options
To make it easy, we provided a set of default options in case you always want to use the same settings:
The Download distribution/S3 bucket field can have the following options:
Either fill in the original name of the bucket, like mybucket
or a download distribution, like https://dhkhhkhkh.cloudfront.net
You can find the correct names in the AWS console. For a bucket, login to the AWS console:
For the bucket name, click on the S3 Service. There you find a list of your existing buckets:
Copy the name and paste in in the Download distribution/S3 bucket field.
For a download distribution, click on the Cloudfront service:
This will show a list with distributions:
Select the download distribution name in the Domain Name Column and copy it.
Unfortunately, it is not possible to select and copy the full address for some unfathomable reason. So, you need do construct it like this: http://d5djz3p829xdh.cloudfront.net
In your situation, the link will be different, but download distributions names always start with a 'd' while streaming distributions start with an 's'. Do not use a streaming distriubtion. It won't work.
Paste your link in the Download distribution/S3 bucket field. We are done with the AWS console now.
URL expires (in seconds)
Here you set the expiring time for your links. This can be as long and as short as you want. On a page with little content, you can get away with 10 minutes or less (600), but keep in mind that visitors are sometimes distracted, so a time 30 minutes is in most cases better (3600).
If a link is expired before the visitor clicks, he/she gets an access denied error and needs to refresh the page to generate a new link.
NOTE: the expiring time is unrelated to the download time. Once the visitor clicks on a link, the file starts to download and when this is a big file, it will keep downloading even if the link expires in the meantime.
If you want to keep the options stored in the databse when you deactivate the plugin for some reason, leave this option set to Keep data upon deactivation.
This is useful if you happen to have compatibility problems with another plugin and want to deactivate this plugin to check whether it has anytihng to do with it. Afterwards, you can activate it again while keeping all keys and default intact.
When you are ready, click the Save button. Now we can place our first link.
Back to the tabs >>
Working with the shortcode
The shortcode is quite easy to adapt, therefore after you inserted the first shortcode via the Link Wizard, then use that example to quickly insert a range of links in your pages and posts.
There are 5 attributes when you do not use the default options but override them:
- title (any regular alpha and nummerical characters)
- file (case sensitive name of the file you link to)
- path (bucket or download distribution)
- expireseconds (only nummercial value )
- target (either _blank or _parent)
[s3medialinksafe title="Adoptie" file="Adoptie-33.pdf" path="http://d1fcj8jsoer4y5.cloudfront.net" expireseconds="900" target="_blank" /].
Although the shortcode shows up here on two lines, do not use new lines or it won't work.
If you filled in all the default options, the shortcode only needs to contains 2 attributes:
[s3medialinksafe title="Adoptie" file="Adoptie-33.pdf" /]
NOTE: Sometimes, links to download distributions turn into real links in the editor. In that case select the link and use the break link icon.
You can wrap the shortcode in html tags like h1, h2, h3, etc... or use a div with a class or inline style to influence the look. See the demo site to view a couple of possible options.