Introducing the GAE-AWS SDK for Java
I’m making what I hope will be a useful release today — a version of the Amazon Web Services SDK for Java that will run from inside of Google App Engine. This wouldn’t work if you simply included the JAR that AWS provides directly into GAE’s WAR, because GAE’s security model doesn’t allow the Apache Commons HTTP Client to create the sockets and low-level networking primitives it requires to establish an HTTP connection; instead, Google requires you to make all connections through its URLFetch utility. This version of the SDK does exactly that, swapping out the Apache HTTP Connection Manager for one that returns URLFetchHttpConnections.
With it, you can make use of the multitude of powerful AWS services (excepting S3, which requires more work before it will integrate properly) from within Google App Engine, making both of these tools significantly more useful. In fact, AWS seems to nicely complement several of Google App Engine’s deficiencies; for example, my original motivation for creating this was to be able to make SimpleDB requests from GAE for a school project I’m working on.
Using it is very simple — just download the full package from its GitHub page, and add all of the JAR files in the package (including the third-party/ directory) to Google App Engine’s war/WEB-INF/lib/ directory, and add them to your build path in Eclipse. Then just use the SDK in the usual fashion! For example, the following lines of code:
AmazonSimpleDB sdb = new AmazonSimpleDBClient(new PropertiesCredentials("AWSCredentials.properties"));
sdb.setEndpoint("http://sdb.amazonaws.com");
String serverInfo = getServletContext().getServerInfo();
String userAgent = getThreadLocalRequest().getHeader("User-Agent");
return "Hello, " + input + "!<br><br>I am running " + serverInfo
+ ".<br><br>It looks like you are using:<br>" + userAgent
+ ".<br><br>You have " + sdb.listDomains().getDomainNames().size() + " SDB domains.";
turns the usual GWT welcome page into this:
I intend to merge in all upstream changes from the real AWS SDK for Java, of which this is simply a GitHub fork. Please post any issues or questions you have in the GitHub page!




Nice work! very cool.
Jason F
June 22, 2010 at 6:27 pm
Neat-o.
Zachary
June 23, 2010 at 7:46 am
With it, you can make use of the multitude of powerful AWS services (excepting S3, which requires more work before it will integrate properly) from within Google App Engine, making both of these tools significantly more useful. In fact, AWS seems to nicely complement several of Google App Engine’s deficiencies; for example, my original motivation for creating this was to be able to make SimpleDB requests from GAE for a school project I’m working on.
+1
Latisha
June 24, 2010 at 12:55 pm
[...] 23, 2010 by Michael Justin Leave a Comment Adrian Petrescu published a version of the Amazon Web Services SDK for Java that will run from inside of Google App Engine. [...]
Amazon Web Services SDK for Google App Engine « Habari! Blog
July 23, 2010 at 1:51 pm
Hi, Thanks for the code, this plus some of what http://github.com/DomDerrien did with the connection wrapping has allowed me to get this working with Amazon MWS.
Ashley Schroder
August 30, 2010 at 4:13 am
THanks so much.
John Middendorf
September 24, 2010 at 4:24 pm
You mention S3 needs more work. What needs to be done? I’m interested in uploading photos to my S3 bucket via GAE.
thanks
John Middendorf
September 24, 2010 at 4:56 pm
Hi John,
The hack I’m using now to parse replies is the problem; it’s actually quite possible that *sending* streams to S3 will work just fine. You can try this out by downloading the source from GitHub and just removing the exclude from my build.xml.
Also, if you’re familiar with the concept, I’m almost certain that generating a presigned URL and having users upload the form directly to that will also work.
In a few days I’ll be releasing a testing suite for this that runs directly on GAE, which will allow me to try out these kinds of things much more quickly. Stay tuned
Adrian Petrescu
September 24, 2010 at 5:02 pm
Hi-thanks for this. Any word on the new suite?
John Middendorf
October 7, 2010 at 1:06 am
It’s out now, check my latest post. I’m ready to start tackling S3 now.
Adrian Petrescu
November 3, 2010 at 11:41 am
[...] might be a solution.I saw one reference of someone 'porting' the AWS Java SDK to GWT; http://apetresc.wordpress.com/20….I don't know GWT very much, other than it transform Java into in Javascript. Perhaps you can [...]
Amazon SQS: Anyone working on a node.js client for SQS? - Quora
November 1, 2010 at 7:07 pm
[...] been getting lots of great feedback on the GAE port of the AWS SDK for Java that I released a few months back as part of a school project I was working on. As I’d hoped, it’s grown way beyond that, [...]
Next Steps in GAE-AWS SDK « World Line
November 3, 2010 at 3:13 am
[...] and reconstitute enough information to be able to call UrlFetchService.  Noteably, Adrian Petrescu used this approach and forked the official AWS [...]
Alistair Jones: AWS SDK for Java modified to run on Google App Engine | Software Secret Weapons
November 18, 2010 at 5:35 am