The 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.
Installation ↑ Back to top
- Upload the ‘woocommerce-amazon-s3-storage’ folder to your ‘plugins’ directory.
- Activate ‘WooCommerce Amazon S3 Storage’ through the ‘Plugins’ menu in your WordPress admin area.
- Configure the plugin settings.
Configuration ↑ Back to top
- Go to aws.amazon.com and sign up for an account there.
- Go to console.aws.amazon.com. Select “Your Name” at the top right corner and then My Security Credentials.
- Go to Access keys (access key ID and secret access key) and click Create New Access Key.
- Copy the Access Key ID and Secret Access Key and keep them, you will use them below.
- Go to the WooCommerce > Amazon S3 Storage menu in your WordPress admin area.
- Paste the Access Key ID and Secret Access Key into the fields.
You will find the “URL Valid Period” in these settings as well. If you use the “Redirect only” method for downloadable products, please enter a value in this field if you want to keep your files hidden to other people. This entry will limit the number of minutes the download links will be valid.
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.
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.
- Go to console.aws.amazon.com
- Select S3 under Services > Storage.
Create an S3 bucket for file storage ↑ Back to top
- 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.
- 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. For naming guidelines, please see the Rules for Bucket Naming in the Amazon Simple Storage Service Developer Guide.
3. On the Create Bucket page’s first section, configure your bucket.
4. In the next section, Block Public Access settings for this bucket, you can keep the default options as it’s possible to edit the permissions later.
5. The default options in the following sections are also sufficient for most cases. When you’re done, click Create Bucket pictured at the bottom right. When done you will be taken back to your list of buckets.
6. To upload files, click on Buckets in the left-hand side menu and click on your bucket’s name.
7. Drag-and-drop to queue your files. Under Additional upload options file-specific settings can be configured. When youre done, click Upload.
Set file permissions ↑ Back to top
Default file permissions are set to private, but can be changed by clicking on the file name, and adjusting the privacy settings by adding or removing privileges under the Permissions tab.
Please make sure that the object permission is set to Read. Otherwise, your files won’t be viewable or downloadable and will throw
Access Denied error.
Configure Digital Products ↑ Back to top
You must use the [amazon_s3] shortcode in the File URL box for this extension to work.
- Go to Products > All Products in your WordPress Dashboard.
- Follow the instructions to create a Downloadable product.
- Enter your amazon_s3 shortcodes in the “File URL” field box.
- You can enter anything you’d like in the “Name” field box.
- To offer multiple downloads, select Add File and repeat steps 3 and 4.
Amazon S3 Shortcode ↑ Back to top
For unique download URLs to files ↑ Back to top
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 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=MyBucket object=MyFile.jpg]">Download File From Amazon</a>
For different region parameters ↑ Back to top
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 bucket is the bucket name and object is the filename including directory if it is located in a sub directory in the bucket, and 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 ↑ 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 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 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 ↑ 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
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.
Downloads not completing ↑ Back to top
If you have issues with downloads being slow or it not completing for your customers then be sure to change the WooCommerce Download method to Redirect. You can change this setting under WooCommerce > Settings > Products > Downloadable Products.
Also, make sure that there is no dash or underscore in your bucket and file names
FAQ ↑ Back to top
What happens if I change the bucket’s name? ↑ Back to top
If you need to change the bucket’s name, which is usually done if downloads do not complete, links to downloadable files within emails will no longer work, while links from the My Account page are updated.
Does this extension support Amazon S3 Accelerate? ↑ Back to top
Currently, Amazon S3 Accelerate is not supported by our extension. This request should get added to the ideas board so we can gauge the interest in this feature and decide whether it’s something we would like to implement. If you want to see this, please add it to the Ideas Board, which is where developers go to look for future plugin features and improvements.
Why my shortcode doesn’t work? ↑ Back to top
If you have spaces in the filenames, please make sure that the spaces are replaced with
+ sign. Otherwise, the shortcode will not work.
For example, if you had a bucket called
MyExampleBucket and a file in that called
My File With Spaces.txt you would be able to create links to that file with the following shortcode:
[amazon_s3 bucket=MyExampleBucket object=My+File+With+Spaces.txt]
Questions & Support ↑ Back to top
Have a question before you buy? Please fill out this pre-sales form.
Already purchased and need some assistance? Get in touch with a Happiness Engineer via the Help Desk.