[FREE] DynamoDBHTTP - Access DynamoDB With Unity WWW

Story time once again… I found out that the AWS SDK for .NET regarding DynamoDB used .NET Sockets, in addition to a few other System.Net resources, so there goes the idea of using DynamoDB for mobile. Someone else over on the AWS SDK forums was all like, “I can’t figure out how to get this to work over HTTP!” No one knew what to do and I thought he was crazy for not just using the SDK until I realized the System.Net thing.

So… I figured, how hard can it be? When I had finally bashed my head against the wall for the 50th time, I contacted some AWS guy and interrogated him thoroughly. With a bit of help from him and an AWS key signing expert, we got it working. Amazing. I owe those guys some beers should I ever make it to Seattle.

Three weeks later it finally worked. Maybe it was four weeks, I don’t know. The HTTP posts had burrowed into my brain, slowly eating my will to live. The most fun part is having to sit around with wireshark and view the actual tcp stream because WWW.error is very generic. When I say generic, I mean like, it says, “error” when you get an error. Okay, maybe I’m exaggerating, but… I spent a lot of time trying to figure this out.

I may never actually use this personally, but it works. Here it is so other people can understand how the delicate innards. I am quite sure the key-signing code will work with any of their other services, so you should… in theory… be able to do anything that accepts an HTTP post with this too (with a little modification.)

Asset Store Link

Any news on this?

I’ve been able to setup a machine on Amazon EC2 and access dynamodb from there, but keeping up an instance on EC2 costs money, so I’m looking for a solution that could access dynamodb directly.

Oh man, it got denied from the asset store because they didn’t think it had instructions or something. PM me your email and I’ll send you a copy of it. You’d be able to access DynamoDB via Unity over their WWW calls, which works… but you’d have to write / convert all your stuff to their specific JSON for the requests. It’s a neat little thing that I never actually needed (I use my own other asset for DynamoDB connections) … but you could, theoretically, from anywhere, access the database just using WWW calls.

It isn’t secure (your access/secret is in your code you’re using to generate the V4 encryption key) so if someone can decompile your game/project (and they can) they now have access to your secret key. It works best for read-only type things such as high scores, user profiles, small pictures, etc.

To be very secure in connecting to DynamoDB, you need to have a ‘server’ of some sort. Pretty sure. I know they have their new credential manager stuff, but… never used it, so… don’t know. So using an EC2 to connect to the database is good, or get a Digital Ocean server for 5 bucks a month, or something else. All depends on the use-case I suppose, maybe having users able to write to your database directly would work, I don’t know.

Anyhow, I’ll try to write up some instructions or whatever and resubmit this and see if it gets approved. In the meantime, PM me an email address and I’ll send you the package.

Okay, I went about writing a bit more info on this and resubmitted it. Hopefully it doesn’t get denied.

Yayie, it’s been approved and listed on the asset store.

So, if for reason you need to connect to an AWS service via HTTP, here ya go.

Thanks for making this, Yukichu!
I read your other posts, you seem to have quite a bit of experience with Dynamo.
I know a bit of sql but nosql is foreign to me, are querries strictly like dictionaries or can you do a more complex, like “give me all the snapshot taken in level 2by all your friends”

And also I see AWS does authentication, it’s called Cognito, do you have experience with that?

Cheers.

Heya! Well, firstly, it seems all my work was for nothing, as there is a AWS SDK for Unity (Mobile) which basically allows you to use the AWS SDK for DynamoDB, S3, Cognito, and a few other things on Mobile with Unity. It’s built specifically for Unity, has some prefabs, etc. Their package makes my little http connection pretty useless, but hey… their stuff is way more robust. Just google “aws sdk unity” and you’re on your way.

NoSQL vs. SQL is more like… in SQL you want to know who ate an apple but you want to know what kind of apples and where the apple was from and them who else ate apples from the same farm (relations), whereas in NoSQL it’s more like you want to know who ate apples, but you want to know it really fast. It’s more simple (usually) with less relations between the data. I don’t really need / want to query the relationship between X Y Z, I just want X and I want it fast. You can query for multiple returns, or scan the whole database, but it’s more intensive.

Anyhow, I haven’t played with Cognito because I am using my own user login system. Cognito seems nice, especially for facebook integration, and I do plan to look at it. Seems pretty keen.