WooCommerce Amazon S3 Storage
WooCommerce Amazon S3 Storage

WooCommerce Amazon S3 Storage extension for WooCommerce enables you to serve digital products through your Amazon AWS S3 service.

Using Amazon S3 storage to serve your digital products give you room for better scalability, offers more reliability, especially when serving big files, and greater download speeds for your customers.

The Amazon S3 Storage plugin for WooCommerce enables you to serve digital products through your Amazon AWS S3 service. Amazon S3 Storage is fully automated allowing you to simply specify the bucket and object name of your file using shortcodes in the download file paths, and when a customer downloads their purchase the extension will translate this into an Amazon S3 URL and serve that file as the download.

Using Amazon S3 storage to serve your digital products give you room for better scalability, offers more reliability, especially when serving big files, and greater download speeds for your customers.

ALSO, get WooCommerce Alipay Cross Border Payment Gateway

Installation

  1. Upload the ‘woocommerce-amazon-s3-storage’ folder to your ‘plugins’ directory.
  2. Activate ‘WooCommerce Amazon S3 Storage’ through the ‘Plugins’ menu in your WordPress admin area.
  3. Configure the plugin settings.

Configuration

  1. Go to aws.amazon.com and sign up for an account there
  2. Go to console.aws.amazon.com. Select “Your Name” at the top right corner and then My Security Credentials.
  3. Create New Access Key
  4. Copy the Access Key ID and Secret Access Key and keep them, you will be using them below.
  5. Go to the WooCommerce > Amazon S3 Storage menu in your WordPress admin area.
  6. Paste the  Access Key ID and  Secret Access Key into the fields.

If you use the “Redirect only” method for downloadable products, please enter a value in the “URL valid Period” field if you want to keep your files hidden to other people.

You can find out which method you are using at WooCommerce > Settings > Products > Downloadable products. We do not recommend using the redirect method, but if you do, this is a necessary setting.

The Amazon S3 extension for WooCommerce also supports multiple buckets within one product so you can easily provide download access to files stored on different Amazon buckets when purchasing one product.

Uploading Files to Amazon Web Services

To be able to use Amazon S3 to serve your files, you will need to upload your files to the Amazon S3 service.

  1. Go to console.aws.amazon.com
  2. Select S3 under Services > Storage. 

Create an S3 bucket for file storage

  1. If it’s your first time using Amazon S3, you will need to create a bucket. A bucket is a unique identifier and can be set to a specific region. This allows for better latencies, lessens costs and even addresses regulatory requirements.
  2. To create a bucket, click the “+ Create Bucket” button at the top left. Give your bucket a name and select the region you would like the bucket to be hosted in.
  3. On the Configure options page, configure your bucket.
  4. To upload files, simply click on your bucket on the left-hand side and then click the “Upload” button and follow the procedure.

Set bucket permissions

  1. You will be asked to “Set permissions”, the recommended default will be to have the permissions set to private.
  2. To change files’ privacy settings, click on the file. Then select “Permissions” at the bottom right. From there you can add/remove permissions.
    1. Note that to keep your files private you need to remove any Everybody permissions and have an Authenticated permission set up with at minimum “Read” permission checked.

    Configure Digital Products

    You must use the [amazon_s3] shortcode in the File URL box for this extension to work.

    1. Go to Products > All Products in your WordPress Dashboard.
    2. Follow the instructions to create a Downloadable product.
    3. Enter your amazon_s3 shortcodes in the “File URL” field box.
    4. You can enter anything you’d like in the “Name” field box.
    5. To offer multiple downloads, select Add File and repeat steps 3 and 4.

Amazon S3 Shortcode

For unique download URLs to files

You can generate unique download URLs anywhere on your WordPress site using the shortcode to offer unique download URLs to files on your Amazon S3 service.

The shortcode is defined as:

[amazon_s3 bucket=MyBucketName object=MyFileName.ext]

You need to specify the two arguments (bucket and object) for the shortcode to work, where the bucket is the bucket name and object is the filename including directory if it is located in a subdirectory in the bucket.

To add a download link to a page or posts you can add the following for example

<a href="[amazon_s3 bucket=MyBucket object=MyFile.jpg]">Download File From Amazon</a>

For different region parameters

The shortcode also supports the parameter region, which is needed if you use different regions for the buckets you have.

It is defined as:

[amazon_s3 bucket=MyBucketName object=MyFileName.ext region=eu-central-1]

You need to specify the three arguments (bucket, object and region) for the shortcode to work, where the bucket is the bucket name and object is the filename including directory if it is located in a subdirectory in the bucket, and the region is defined according to the Amazon API.

A list of different regions can be found at Amazon API Gateway Regions.

Files Download With Funny Names

When you have your store set to make use of ‘Force Download’ and make use of the private URL functionality of the Amazon S3 plugin your files will be the filename of the URL that gets generated, to get around this you need to set your store to make use of ‘Redirect’ for downloads and optionally just add some metadata to the file on Amazon S3 to make it a specific filename than the one you uploaded it as. By default, your file will be downloaded with the name you uploaded it as.

To change the metadata, go to your AWS console, locate the file and then click on it. Select “Properties”. In the next tab, choose Meta Data > + Add Metadata, select “Content-Disposition” from the drop-down and in the value drop-down enter the following: ‘attachment; filename=filename.gif‘ be sure to change filename.gif to the filename the file must be saved as.

Audio files playing and not downloading

This can be resolved in the same way as the Downloads with funny names issue.

1/ Login to the S3 console, select an object

2/ Select the Properties button (if the properties window at the bottom isn’t already visible).

3/ Select the Metadata tab.

4/ Select the Add more Metadata button.

5/ Select: Content-Disposition in the drop down.

6/ Enter the Value: attachment.

7/ Save.

Download “WooCommerce Amazon S3 Storage plugin” view – Downloaded 0 times – 67 KB

Check

WooCommerce Ambassador Affiliate Program and Woocommerce Anti-Fraud

LEAVE A REPLY

Please enter your comment!
Please enter your name here