[erlang-questions] {erlang, aws} = erlawys.

Jeremy Thurgood jerith@REDACTED
Fri Aug 17 12:54:44 CEST 2007


Bernhard Damberger wrote:
> I thought I would let people know that I did a first pass at
> implementing the Amazon Web Services (AWS) APIs in erlang. It
> implements the ec2 and fps APIs.
> 
> You can check it out at http://code.google.com/p/erlawys/.
> 
> If you have any questions or comments let me know.

Firstly, you should avoid using -import(), since it makes it a bit more 
difficult to figure out what module your functions live in.

It looks like your auth failures are due to improperly URL-encoding the 
parameters. This is especially important with the signature, as 
base64-encoded strings may contain a number of illegal characters.

Here's the URL-encoding code I use in my (incomplete) sqs library:

hexify_char(Char) ->
     Must_escape = lists:member(Char, " <>#{}|^[]+`;/?&:@=%\"~\\"),
     if
         Must_escape; Char < 31; Char > 177 ->
             io_lib:format("%~2.16.0B", [Char]);
         true ->
             Char
     end.

url_encode(String) ->
     lists:flatten(lists:map(fun(C) -> hexify_char(C) end, String)).

HTH,
--J



More information about the erlang-questions mailing list