Using Amazon S3 with Linklok

Amazon S3 is great place to store your downloads for use with Linklok. It can handle up to 5TB files with fast downloads without using bandwidth, storage or other resources on your server. Amazon provides an easy to use web based console for managing your S3 account so here is a quick getting started guide.

Setting up an S3 account

1) Signup for an S3 account at https://aws.amazon.com/s3/.
2) Once you are signed up you can login to the console at https://console.aws.amazon.com/s3/home
3) Create a bucket to store your files. Click Create Bucket and enter a unique name using only lowercase letters. Select the region that is most suitable for you. We recommend that you set your bucket to private access only for security. This way only Linklok can access the files. This is the default setting for new buckets anyway.
4) Linklok needs to have an access key id and secret access key for your S3 account so that it can access the bucket. To get those click Security Credentials in your user account menu at the top of AWS. Click Continue to Security Credentials if a warning dialog appears.
Now click Access Keys in the page that appears.

Click the Create New Access Key button which will create the keys we need. Click the Show Access Key link to display the keys so you can copy them. Alternatively you can download them in a text file.

S3 file path
To setup a download path to use S3 we use a special path like this:-
s3|region|accesskeyid|secretaccesskey|bucketname|filename
	
Notice this path uses the pipe character | to split the various parts.
s3 This tells Linklok that this is an S3 path
region The region identifier for your bucket such as us-east-1
There is a list of regions at  http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
accesskeyid This is the access key id
secretaccesskey This is the secret access key provided
bucketname This is the unique bucket name where you have stored the files. S3 requires all buckets to be lowercase only
filename The filename to access
Example for Linklok Paypal (similar in Linklok Mals, 2CO and Asecurecart)
$Products[] = "id1,Your product,USD=29.95,s3|eu-central-1|AKIAI4D65EB3DE2XQ|+cvHtqv67dfgh4r67fhiq4HWgK/hqHlmc0TSI8|mybucket|myfile.zip,0,1440";
		
Example for Linklok URL
$LinklokLocation="s3|eu-central-1|AKIAI4D65EB3DE2XQ|+cvHtqv67dfgh4r67fhiq4HWgK/hqHlmc0TSI8|mybucket|";
	
Example for Linklok Clickbank
$DownloadLocation="s3|eu-central-1|AKIAI4D65EB3DE2XQ|+cvHtqv67dfgh4r67fhiq4HWgK/hqHlmc0TSI8|mybucket|";
	
When a download link using S3 is clicked Linklok is first called to perform checks on the link as usual. If all is well then it generates a secure S3 download link to the file and redirects the browser. The S3 link generated has a short 5 minute expiry time so if it is captured it will not be of much use to anyone.

Using folders in S3

If your bucket contains folders then they can be used in the path like this.
s3|region|accesskeyid|secretaccesskey|bucketname|folder/filename