ActionScript Library for Amazon S3

I’ve been working on an Amazon S3 client in Apollo, and I finally got around to extracting the S3 library and making it its own project. I put it up on Google Code under the name as3awss3lib.

The library will only work in Apollo because there are too many restrictions in the browser player for it to work. Since I knew it wouldn’t work in the browser anyway, I went ahead and used some Apollo APIs. It also has dependencies on As3Crypto, as3corelib, and Flex (you can use the free Flex SDK).

I haven’t implemented everything S3 supports yet. Specifically, I haven’t implemented access control (everything is private) and the bucket listing pagination functionality. But all the hard protocol work is there so the rest is easy to add. Right now, you can:

  • Get a list of buckets.
  • Create new buckets.
  • Delete buckets.
  • Upload objects.
  • Download objects.
  • Delete objects.
  • Get a temporary public URL to an object.

I’ll release the application I’m building on top of the library as soon as we update the public release of Apollo. It allows you to drag and drop and copy and paste files to and from S3.

29 Responses to ActionScript Library for Amazon S3

  1. Abdul Qabiz says:

    Great, yet another good stuff from you man… Thanks for making it open-source…-abdul

  2. Also just saying tanks! 🙂

  3. Keith says:

    Hey Christian,The link to Free Flex Lib on the google page is broken.

  4. Hi – the as3awss3lib appears to be missing from Google Code/ Can you pop it back up sire?thanks,biffer

  5. timheuer says:

    salsa is my friend…would LOVE to have public URL and access control as top two added features — thanks christian!

  6. Dope! I was wondering if someone took initiative for this yet. Thanks Christian.

  7. Biffer, the project is located here:, there was actually a bug in the Google Code site that broke several links (they were adding an additional “http” to the beginning. I’ve fixed them.Tim, I’ll add these features for the next release.Christian

  8. Jonathan says:

    I ran across your library while researching use of AWS S3 from browser Flash player. I’m new to Flash and S3. You mention that there are too many restrictions on the browser player for as3awss3lib to work in that env. Is it impossible to access S3 from broswer Flash? or are there certain operations that are possible?Thanks!

  9. Chris says:

    Hello Christian,I would like to create an AIR uploader so I took your source code but there a probleme with the assw3 libs when I try to compile your application, the error is that “The name of the definition ‘com.adobe.webapis.AWSS3Event:AWSS3Event’ must match the path of the files AWSS3Event and AWSS3.Could you give me the solution?Thank you very much and congratitulation for your hard work on this project.Chris

  10. The download link on the Google page seems to have disappeared again.I can download the dependent projects without any problem.Can you fix this? Thanks…

  11. rob says:

    I’m curious about the restrictions that require Air to use S3. Are you sure it’s not possible without Air?

  12. rob says:

    Regarding the previous post, I’m just interested in uploading, not downloading with actionscript without Air. There’s an Ajax solution that’s kind of interesting called S3Ajax.

  13. Dan says:

    Now that Flex Builder 3 is out is there any chance we can get an update so that we can set the access control?Thank you for making such a handy library,-Dan

  14. Flex Ajax says:

    What a great flex utility. I’m using it to secure a xmpp data in an instant messaging client. up the good work.

  15. markus says:

    is there a way to change the acl by uploading a file??please help me ( contact me by email )thx

  16. Dan says:

    Hi!I was wondering what happened to the Salsa Demo? It’s no longer listed on the Gallery/Sample Applications.I noticed that with the latest Flex Builder 3 (M4 Beta 3) it says that “shouldCacheResponse” property in the getURLRequest() method in does not exist. (Around line 331).After commenting it out to get it to compile I noticed that there’s now an i/o error with the ID 2038. Any suggestions as to what might be the problem?For those looking to do ACL there’s a document on Amazon suggesting that you change the requestHeaders so one way might be to do: req.requestHeaders.push(new URLRequestHeader(“x-amz-acl”, “public-read”));I’ll confirm this as soon as I can get the library to work in FB 3.Thanks!-DanEmail: danprime at gmail

  17. music lover says:

    Yo, yo! 😉 Finally I found what I need. Thanks 😉

  18. Todd says:

    Hello,Thanks for the jump start, we needed this functionality for a client app, but as was mentioned somewhere else, if your app is for clients who will use your s3 account, it’s not good to provide the secret key in your app. Also, any news on what happened to Salsa?I have been working on rewriting some of the functions in your library to instead use a php web service to authenticate the key, then the AS3 library can complete the direct upload to S3. This allows for management by our server of what gets put in our S3 account without having to receive the file upload and transfer to S3, the AIR app can upload direct to S3.I am wondering if you would like to include this into your Google library as I’m sure others creating AIR apps will need this functionality. I am also receiving that same 2038 file I/O error when I try to tag the request for “public-read” and wouldn’t mind getting some help from anyone else working on this. Thanks,ToddEmail: toddwatson23 at gmail

  19. Todd says:

    Hey,I just thought I would follow up on this, never heard anything more and am still looking but here is my work around. I decided to just give up on setting the acl in Actionscript because I kept getting the 2038 file I/O error and everything worked fine in the upload without it. I figured that I need confirmation on my server that the file was successfully uploaded to S3, so I took the route to upload with no acl tag, then send a confirmation to our php server who then sends a set acl command on the file that was uploaded. The php library works great and I have no problem getting the acl reset. Once that is confirmed by my php server, it responds back to the air app with confirmation that everything was successful. Kind of a round-a-bout way but we needed the confirmation step on our server anyway, so we added the acl there.Anyway, there’s probably a really dumb reason why the ACL isn’t working on upload in ActionScript and I would love to hear if someone figures out why because I would prefer the tag is set on upload. Thanks,ToddEmail: toddwatson23 at gmail

  20. Matt Weagle says:

    I think I may have an idea as to why the upload is failing with 2038.The AS3 lib creates custom headers for S3 authentication in getURLRequest(). This works for GET and DELETE, but the headers aren’t sent when the upload is attempted with PUT. I found this out by tracing the URLRequest object at the same time I was using a packet sniffer to see what Air was actually sending. The URLRequest object has the proper authentication data and date, but the wire trace shows only the following headers:Connection: closeUser-Agent: Adobe Flash Player 9X-Flash-Version: 9,0,99,0Accept-Types: text/*Content-Length: 18Host: also replies with an HTTP 403 which seems to support this.It looks like Amazon recently added POST support, but that’s just more data to track. There’s also a WSDL that I’ve not tried binding to which may avoid the problem. Hope this is helpful.

  21. Chris F says:

    I’m trying to use this lib in Flash CS3 Pro. I’m fairly new to ActionSCript (but not Javascript or scripting in general).I’ve d/l’d the deps and checked out the source for this. I’m using the Flex 3.0 SDK.I added the top level src dirs of all the deps to my app’s classpath, but when I run it I get:Error: No class registered for interface ‘mx.resources::IResourceManager’.from the DateFormatter…I’ll be darned if I can’t figure out how to register a class for this… any hints?

  22. This bug on Adobe’s JIRA explains your problem, Chris F:

  23. To Chris F: Check out the bug entry for this:’ve appended a possible workaround to that bug entry, let us know if it works!

  24. espen says:

    Hi Christian,thanks for working on the library I just wanted to alert you to a bug I discovered working with buckets with special configuration.When trying to use your library for accessing S3 buckets I discovered an error which is due to the fact that buckets created in the EU and US use different access URLs.Using the library I S3 sends back a PermanentRedirect error ( because the bucket was created with a special bucket configuration (, in this case it was created as an EU bucket, an error is thrown.To work around this I added an IOErrorEvent.ERROR handler in the listObjects method of the AWSS3 class which retries the request and retries the request with the EU URL format for the bucket.A permanent solution which should go into the library would be to use the BucketLocation ( request first to get the correct configuration for the bucket.

  25. steve says:

    I can’t seem to find the code to download at are no files to download, where can I find the library?

  26. joeoe says:

    I can’t seem to find the code to download at are no files to download, where can I find the library?Christian says: You have to check the code out via SVN. There are no zip file downloads available.

  27. mpeeba3 says:

    any idea where the flex app or anything has gone, has it been updated for the release version. I have svn ed the code from google, but would like some pointers on the flex app,thanks again

  28. Noman says:

    I just wanted to alert you to a bug I discovered working with buckets with special configuration, thanks.

  29. Glory says:

    After long search, got your code. That support in AIR. So I have taken code and implemented in flex web. However it throws error as “Error #2096: The HTTP request header Date cannot be set via ActionScript.” when i run my application. Please help me.