Boost WordPress Audio w/ Amazon S3

The Simple Storage Service (S3) from Amazon is an easy way to serve information. Its high availability and low cost make it a no-brainer when it comes to hosting.

Recently, a friend moved his website (the Astropope) from my server to that of a hosting company (for which he presently works). Along with his account comes 3 GB of storage, except he currently uses about 5 GB. To help with the transition, we decided to move the majority of content over to S3.

In order to do this, we got an account, uploaded everything, made a DNS record, and then ever-so-slightly modified a WordPress plugin.

The steps we took are detailed for your convenience:

1. Sign up for an S3 account.

2. Download, install & configure the S3Fox plugin for Firefox.

3. Amazon uses a bucket as a means for organizing information. You may refer to a bucket as a unique, top-level directory. Many directories may exist within a bucket, but the most absolute of those contained within is a ‘bucket’. Create a bucket named s3.[yourdomain].com. In that bucket, make an audio directory. So now we have something along the lines of s3.[yourdomain].com/audio.

4. Using S3Fox, upload your mp3 files to the newly created audio directory within the bucket.

5. Right-click the audio directory and specify an ACL with read access for public requests. Note: Without specifying an ACL w/ public read access, it won’t work.

6. Within WordPress, install the Audio Player plugin.

7. Once installed, modify the plugin as such:

edit audio-player.php

Under // Options Default add:
add_option(‘s3_url’, ”, “Amazon S3 URL”, true);

Under // Global variables change $ap_audioURL to:
$ap_audioURL = get_settings(‘s3_url’) . get_option(“audio_player_web_path”);

Under // Update plugin options add:
update_option(‘s3_url’, $_POST[‘s3_url’]);

edit options-panel.php

<th width=”33%” valign=”top”><label for=”ap_audiowebpath”>Audio files directory:</label></th>
<input type=”text” id=”ap_audiowebpath” name=”ap_audiowebpath” size=”40″ value=”<?php echo( get_option(“audio_player_web_path”) ); ?>” /><br />
Recommended: <code>/audio</code>
<!– snipit starts here –>
<th width=”33%” valign=”top”><label for=”s3_url”>Amazon S3 URL:</label></th>
<input type=”text” id=”s3_url” name=”s3_url” size=”40″ value=”<?php echo( get_option(“s3_url”) ); ?>” /><br />
<?php $string = get_option(“siteurl”);
$url2 = substr($string, 7);
echo “(e.g. http://s3.” . $url2 . “)”; ?>
<!– snipit ends here –>

Alternately, you can upload/replace with these pre-modified files:
(be sure to rename from .ph_ to .php)

Login to WordPress, then go to Settings -> Audio player and add http://s3.[yourdomain].com to the new field below the audio files directory.

8. Add a cname (alias) at your domain registrar:
S3 ->
(e.g. s3.[yourdomain]
where S3 points to (TTL of 1 hr is acceptable.)

9. Post a song according to the directions for the plugin.

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Did it work for you? Did you run into any trouble? (I’d be happy to help you set this up if you’d like assistance.)

— Edit:  9.16.09 —

Version 2.0 beta 6 of the Audio Player plugin includes an option for a custom URL.  When upgrading to this most recent version, there is no need to modify any source code.  Nice!

Also, the most recent version of the WordPress S3 plugin version .4 adds a setting for virtual hosting:

Make sure you check the ‘Bucket is setup for virutal hosting’ box.  If you see DNS warnings at the top of the plugin screen, refresh the page and it should go away (if you had this setup previously).

About Benjamin Perove

Ben has been associated with a broad spectrum of technologies starting from an early age, and he's contributed to the success of many businesses and enterprises professionally since 2001. Most of his time is spent building cool stuff. When he's not working, he enjoys reading, playing acoustic guitar, and being with friends. He currently resides in Medellin, Colombia.

  • iceolate

    Yeah, this works pretty good on my site so far. Nice choice of a song for the example above.

    By the way, I should point out what Ben told me. If anyone is using Firefox, you’re gonna run into a little issue with the newer version of Flash not loading the audio.

    If you uninstall it and roll back to a previous version, you should be in the clear.

    No problem with IE, however.

  • Ben
  • Matt

    Hey Ben, this is exactly what I'm looking for! Problem is, I'm using Audio Player 2.0 Beta. Please fire me an email if you think you can help.

  • Matt

    Hey Ben, this is exactly what I'm looking for! Problem is, I'm using Audio Player 2.0 Beta. Please fire me an email if you think you can help.

  • Pingback: Excellent, just gotta recomend this.()

  • Pingback: Dual-Boot a Sansa e260 with Sandisk OG and Rockbox |

  • Apache

    What if I want to play a playlist of music using JW player. Could you tell us how to modify the options in the wordtube plugin so that we could host audio and video content on S3? Amazing work by the way been searching for something like this for a while

  • reviewazon

    Thank you so much for this post. I use the reviewazon plugin. Reviewazon is the easy and simple way to add amazon affiliate product to your website.

  • Franklin

    How long did it take you to write this blog.

  • Maria Rogers

    i have just signed up with the amazon affiliate program and i am still not earning a good deal of cash from them.-;`

  • Confused

    Ok, I’ve had enough!

    May you plz tell me what the name and artist of this song you used in your post are??? I’ve went through hell to find out but no use!

    I know from the file properties that the name is: Open your Eyes… but I can’t find it anywhere online… searched the lyrics but no use. Help plz.


  • Wire Gauge :

    i just wish that mp3 players could also have some 10 band equalizers and bass boost functions,~`

  • FC Bayern München

    [Trackback] Boost WordPress Audio w/ Amazon S3 | [TRACKBACK]

  • Long Magoun

    […] Boost WordPress Audio w/ Amazon S3 | […]

  • Filmy Download

    I like the efforts you have put in this, appreciate it for all the great blog posts.

  • invest liberty reserve

    Boost WordPress Audio w/ Amazon S3 | I was recommended this web site by my cousin. I’m not sure whether this post is written by him as no one else know such detailed about my trouble. You are wonderful! Thanks! your article about Boost WordPress Audio w/ Amazon S3 | Best Regards Schaad Veronica

  • sam

    Hi All

    I have developed a amazon s3 music player here which also gives you the option to embed a mp3 playlist anywhere on you website etc check it out works on ipad iphone etc

  •,tynki/ kwiaciarnia wysyłkowa

    I will right away grab your rss as I can’t to find your email subscription hyperlink or e-newsletter service. Do you’ve any? Kindly let me realize in order that I may subscribe. Thanks.

  • puma shoes

    look and bear up them with high knit socks rrncluding a jolly small paid, pleated schoolgirl cloth.
    Feel sure that a understand all outcomes on the contend.
    Air Max 90 Free descent with assorted of sports shoes quietly into the sky.
    Getting this done is very better and very fantastic.

Got WordPress Security?

You will definitely wish you had downloaded my top 5 recommendations when you're cleaning out malicious Javascript from deep within you WordPress site. Enter your email and get the PDF right now, before it's too late.