Search

Amazon S3 Storage

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 choose a bucket and object through dropdowns on the product page to link to your digital product.

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

Please note that in order to make use of the Amazon S3 Storage plugin for WooCommerce you will need a Amazon AWS account.

Installation ↑ Back to Top

  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 ↑ Back to Top

  1. Go to http://aws.amazon.com
  2. On the ‘My Account / Console’ menu at the top, select ‘Security Credentials’.
  3. Copy the ‘Access Key ID’ and ‘Secret Access Key’ and keep them, you will be using them below.
  4. Go to the ‘WooCommerce -> Amazon S3 Storage’ menu in your WordPress admin area.
  5. Paste the  ’Access Key ID’ and  ’Secret Access Key’ into the fields.
  6. If you are having issues with SSL verification, you can disable it by ticking the ‘Disable SSL Verification’ checkbox. Please note that this is not recommended by Amazon and should only be used as a last resort.
  7. If you plan to make your files private, eg. to prevent link sharing, enter an amount in minutes into the ‘URL Valid Period’. This will generate a unique URL to the file on Amazon that will only be valid for the period you specify.
It is critical that if you want to make files private that when you upload them to Amazon through the AWS console you select that the file is for Authenticated Users, if it’s set to Everybody the file will be available to everybody with a link.

Uploading Files to Amazon Web Services ↑ Back to Top

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 http://aws.amazon.com
  2. From the ‘My Account / Console’ menu at the top select ‘AWS Management Console’
  3. Select the ‘S3′ tab.
  4. 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, lessen costs and even address regulatory requirements.
  5. To create a bucket, click the ‘Create Bucket’ button at the top left under the Buckets heading. Give your bucket a name and select the region you would the bucket to be hosted in.
  6. To upload files, simply click on your bucket in the left hand side and then click the ‘Upload’ button and follow the procedure.
  7. To make files private/available to anybody, simply click on the file you uploaded and click the ‘Properties’ button.
  8. There should be a ‘Permissions’ tab at the bottom of the screen, click it and from there you can add/remove permissions. Please note that to keep you files private you will need to remove any Everybody permissions and have an Authenticated permission set up with Open/Download checked.

Configure Digital Products ( WC 2.1+ ) ↑ Back to Top

With the introduction of WooCommerce 2.0, there is the ability to offer multiple downloads per product. You can now simply use the new [amazon_s3] shortcode in the File URL box.

  1. Go to the ‘Products -> Products’ in your WordPress admin area.
  2. Select the product you would like to edit or add a new one.
  3. On the ‘Product Type’ box makes sure the ‘Downloadable’ checkbox is checked.
  4. On the ‘Product Data’ box go to the ‘General’ tab.
  5. Locate the ‘Downloadable Files:’ option.
  6. Enter your amazon_s3 shortcodes in the ‘File URL’ field box.
  7. You can enter anything you’d like in the ‘Name’ field box.
  8. To offer multiple downloads, click on Add File and repeat steps 6 and 7.
WooCommerce

Adding files to WC 2.1 using the amazon_s3 shortcode

Files Download With Funny Names ↑ Back to Top

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 get 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 meta data 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 meta data, go to your AWS console, locate the file and then click the properties button. Under the ‘Meta Data’ tab click the ‘Add more metadata’ button, select content disposition from the dropdown and in the value dropdown enter the following: ‘attachment; filename=filename.gif‘ be sure to change filename.gif to the filename the file must be saved as.

AmazonS3

Amazon S3 Shortcode ↑ Back to Top

The release of v 2.0 of the extension add the new Amazon S3 Shortcode, you can now generate unique download URL’s 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 follows:

[amazon_s3 bucket=my_bucket_name object=my_file_name.ext]

You need to specify the two arguments bucket and object for the shortcode to work, where bucket is the bucket name and object is the filename including directory if it is located in a sub directory 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=my_bucket object=my_file.jpg]">Download File From Amazon</a>

WooCommerce 2.0 Support ↑ Back to Top

With the release of WooCommerce 2.0 comes significant changes to the downloads functionality. In WooCommerce 2.0 you can now offer multiple downloads per product to your customers, the Amazon S3 extension does support this but now works in a different way then in previous versions of WooCommerce.

Don’t worry about migrating to the new method the extension uses in WooCommerce 2.0 as the extension has a built in updated that will automatically migrate your pre WC 2.0 Amazon settings to the new format.

What this means is that once you activate the new version of the extension on WC 2.0 it will scan through all your previous products that makes use of the Amazon download functionality and convert it to the new shortcode version. You will see once activated that the products will automatically contain a amazon_s3 shortcode in the products File Paths properties.

Audio files playing and not downloading ↑ Back to Top

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

    1. Login to the S3 console, select an object (in my case, an audio file)

S3-selectfile

  1. Select the Properties button (if the properties window at the bottom isn’t already visible).
  2. Select the Metadata tab.
  3. Select the Add more Metadata button.
  4. Select: Content-Disposition in the drop down.
  5. Enter the Value: attachment
  6. Save

s3-downloadfile-settings

Back to the top