From the course: Hands-On Development in AWS

Unlock this course with a free trial

Join today to access over 24,400 courses taught by industry experts.

Using the Node.js SDK

Using the Node.js SDK

- In the 02 folder in our repository, I have two examples, very extreme basic examples of how to interact with the SDK, one for Python and one for Node. We're going to look at Node real quick. Let's go into this Node directory. I have already configured the application. This config.json file is read in by the application upon execution. Let's take a look at app.js and run through what it's doing. We have var AWS is created using the AWS SDK package. This can be installed with Node Package Manager. We load the config FromPath using this config.json file. If you have not configured it properly, it gives you an error and then it exits. We create an EC2 object. This is an instantiation of the AWS.EC2 result. We then run the method describeinstances of that EC2 object. We have a callback function that spits out the data that is returned, assuming that the authentication was successful. We have our total reservations. This is a length of an array in the json that is returned. If it is…

Contents