Hi Pr0eX,
Thanks for sharing. I'm sure some of our users will find this useful.
Regards,
Liam
Thank you for posting this!
I am trying to make some requests to the AWS sqs using your code.
I am however getting errors about the signature being incorrect. I know this posted a couple years ago so I was wondering if this was still working for you. Or maybe there was an updated version?
Thank You!
Haven't been here for two years, thought they would have a complete AWS integration by now. :)
So to the problem at hand, this post describes Version2 of AWS signing ( https://docs.aws.amazon.com/general/latest/gr/signature-version-2.html ) by the look of it, with SQS you still should be able to use it ( this site recommends using Version4: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-api-request-authentication.html ).
Shortly after I implemented Version2 I also implemented Version4, so maybe I could find it lin one of my archived backups. Once I get to access them I will try to find it.
In the meantime you could implement it yourself :) it's described by AWS API page in detail somewhere (like: https://docs.aws.amazon.com/general/latest/gr/signature-v4-examples.html ). For gamesparks you would need to use a function they introduced after I found a bug, it's called: hmacSha256HexWithHexKey
example usage:
var sD = Spark.getDigester(); var firstHash = sD.hmacSha256Hex("somekey", "sometext"); var secondHash = sD.hmacSha256HexWithHexKey(firstHash, "sometext2"); Spark.setScriptData("hash", secondHash);
-Best
Pr0eX G.
Here is a small howto on how to call AWS REST API from Cloud Code, since AWS is using a signing method, you would need to implement that to use and here is how.
Step 1 - Create event with following Attributes:
Now you can call your Cloud Code with given parameters, this example demonstrates how to use aws ec2 to start some given instance:
Enjoy your AWS API Requests! :)