Node.js as script include ? OR best AWSSDK as scrip include

JK1
Giga Expert

Hey experts,

I am struggling with how to add node.js (Already added require.js and seems working) as script include. In general i need aws-sdk.js to be added as script include so i can use it to do http calls to AWS EC2 (var x = new AWS().EC2(); ........ )

Anyone achieved this? And no, I dont want to pay for Cloud Orchestration

Cheers,

Joro

1 ACCEPTED SOLUTION

Community Alums
Not applicable

You can use bower and then use the built as script include. You cant run node.js in your Rhino envionment / JVM (if you dont have access to the source code of course). As an alternative - you can use MID server for that, but I dont see much benefit of that apart from few use cases.

View solution in original post

10 REPLIES 10

jnimmala
Kilo Contributor

Is there a link that can give more details about this? I want to call AWS SDK inside a working javascript activity. Can you give more details how you did this?

Hi Jnimmala,

I use the AWS JS SDK for browser directly - this is the CDN :

<script src="https://sdk.amazonaws.com/js/aws-sdk-2.189.0.min.js"></script>

I use it from a widget , so in the HTML and invoke it from the controller. But this was only a PoC, it its feasible and doable. So as it is working and doing the trick, I will need to revamp all my code and move this to the back end, where I will do direct http requests to Amazon. The bad news here is that you need to sign this request - read that as make several encryption , from the request itself to whatever there is to sign. Here is a reference what you need to do - https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html

Note that any attempt done from my end (from the pas 2 weeks) to use the JS SDK failed badly. I either need to use Node.js set on the MID server host or directly the command line tool. But this is no more cloud solution as you can see, as it is dependent on this( those if scaled) machines 😞 . Trying to use separate crypto.js lib or directly the browser JS SDK as client callable include , failed as well. So, my only choice left is to use SncAutheticate and encrypt method. Although I am not very happy with it as it gives me really weird results - the encrypted string is definitely not hex but clean SHA1/256. So I am still struggling there. As soon as I have any results - positive or negative - will post it here.

 

Cheers,

Joro

 

steph3
Tera Contributor

Hi Joro,

Were you able to accomplish this using SncAuthentication?

 

Thanks!

Hi,

sorry for the late reply. Yes I was. I used another external library in order to get the encrytped value in bytes. Then it was all fine. 

Although, it seems that SNCAuthentication should do the trick as well.

Hi,

How you are able to achieve the creation of AWS signature using the SNCAuthentication method?

Thanks