Amazon S3 - Overview
The Amazon S3 add-on for Easy Digital Downloads allows you to host download files in your Amazon S3 account. This is secure and more reliable than storing the files on your own hosting account.
First, download and install the Amazon S3 extension. If you're unsure how to install it, consult our extension installation documentation. Once installed, navigate to your Plugins page inside WordPress and click Activate.
Once activated, go to Downloads → Settings → Extensions and enter your Amazon S3 account info in the section that says "Amazon S3 Settings".
Here you will need to enter several pieces of information.
- Access Key ID and Secret Key - These can be obtained by creating an IAM user in your S3 account. See our guide for information on how to create an IAM user with the proper permissions.
- Bucket: This is the default bucket that you want files to be uploaded to. In order to create new buckets or get a listing of your current buckets, go to your S3 Console (you must be logged in to access the console). Your buckets will be listed on the left. Enter the name of the bucket you would like to use as the default here. When uploading files to Amazon S3, you will have the option to select the bucket you wish the file to be uploaded to.
- Amazon S3 Host: This is the S3 host that your bucket is using. Most of the time this can be left as default. However, if your site has issues accessing your bucket, try changing this to the Endpoint for your bucket's region. You can find your bucket's region by logging into your AmazonS3 account, clicking on S3, and then taking a look at the region column listed beside each bucket. It will say what the region is. Once you know that, find the right corresponding host listed on the Amazon S3 Region Documentation. Copy and paste that host and hit save in your WordPress.
- Link Expiry Time: This is the number of minutes that the dynamically generated URL is valid for. When a customer clicks on a download link delivered by Easy Digital Downloads, a new URL for the file on Amazon S3 is generated on the fly. This is the number of minutes the new, secret URL is valid for.
Once you have entered all three settings, you are ready to go.
You will upload files to a downloadable product in exactly the same way as before, but now you will have two new tabs in the media uploader called Upload to Amazon S3 and Amazon S3 Library. When you upload a file from this tab, it will be automatically uploaded to your Amazon S3 account. Any file that you upload to S3 will be accessible from your WordPress Media Library, just like any other media file.
Note: Do not copy and paste the URL directly from your Amazon S3 library into the File URL field. Doing so will result in an Access Denied error message when attempting to download the file.
- EDD Amazon S3 can only upload files within the limit of your WordPress install. If you need to upload files larger than permitted by WordPress, upload them via your Amazon S3 portal.
- Files will only be sent to Amazon S3 if they are uploaded from the Edit screen for Download products.
- All bucket and folder names in your Amazon S3 account must be all lower case and not contain any special characters. See Amazon's documentation on bucket naming restrictions.
- Not all versions of S3 are available in all Regions. This chart will show which are available in your region.
- Files delivered through AmazonS3 will deliver as "redirect" even if your store is set to "forced". Learn More.
Common Issues and Questions:
Files open in browser instead of downloading
This can be resolved by adding a content type header to your files in Amazon S3. See this page for more details.
Will customers be able to see the actual URL of the file and simply download it directly?
No, the customer will see a URL going to your own store, where EDD will translate the location so the download works without the customer seeing the original Amazon source URL.
Error: SSL certificate problem: unable to get local issuer certificate
This error means that the SSL certificate on your website's server is invalid or installed improperly. To resolve this, contact your hosting company and request that they verify the certificate is installed properly and valid.
Error: Access Denied
This error means that the user of access key ID and secret key you are using does not have the necessary permissions to access S3 buckets and resources.
To resolve this, you will need to attach a new permissions policy to the IAM user. See our guide on creating an IAM user with the proper permissions to resolve this error.
You may also see this error message if you copied the URL from Amazon S3 and pasted it into the File URL field of your Download. Please see the note above regarding the proper steps that need to be taken to link your files to your Downloads.
This error happens due to a mis-configuration of your web server's timezone settings. To resolve it, contact your hosting company and ask them to re-configure the timezone settings properly.
If you receive this error, followed by an error message that says The request signature we calculated does not match the signature you provided, it likely means that your bucket name contains capital letters or spaces. To resolve the issue, rename your bucket so that it does not contain any capital letters. You may also create a new bucket without any capital letters in the name to resolve it.
Error: NoSuchKey The specified key does not exist
This error occurs when there's an issue with the way the file, or even the bucket, is named. All punctuation and special characters should be removed
For example: If you have a file named test-file-one.mp4.zip change it to testfileone.zip
Other errors or problems uploading files to Amazon S3
If you have issues uploading files to Amazon S3 or accessing existing files in Amazon S3, consult the steps below to resolve the issue.
- Check your Amazon S3 Host settings in Downloads → Settings → Extensions → Amazon S3. Ensure that your host is set up correctly, including checking you have set up the correct region (read the point on Amazon S3 Host above to see how to do this).
- Ensure the filename of your file is within the maximum limit of 1024 characters. You can find more information in Amazon's documentation on how to correctly format your filenames.
- If you have recently switched to a new Amazon S3 account, and are having trouble uploading files to your bucket(s), this is typically a temporary issue that can happen soon after creating new buckets or accounts. It should resolve itself automatically after a few hours. See Amazon's documentation for more information on this.
- Still no luck? Contact support and include the exact error message or behavior you're experiencing.
Software License updates failing due to Download failed. cURL error 8: Invalid Content-Length: value
It's possible the Amazon S3 extension is not forcing redirect for downloads. If you see this error try setting the Download Method to Forced.
Customer sees Update Failed: Download failed. Internal Server Error when attempting to update a plugin
Confirm that the source file to be used for automatic updates is selected in the Download's licensing settings.
You will likely see the following PHP Fatal error in the store's PHP error log file:
PHP Fatal error: Uncaught InvalidArgumentException: Found 2 errors while validating the input provided for the GetObject operation: [Key] is missing and is a required parameter [Key] expected string length to be >= 1, but found string length of 0 in /home/ph198/public_html/wp-content/plugins/edd-amazon-s3/vendor/aws/aws-sdk-php/src/Api/Validator.php:65