Claudia.js

Unlike APEX, Claudia.js is designed to work only with Node.js. It simplifies the creation, deployment and management of your Node.js functions without having the need to make any alterations to your code. The prerequisites to get started with Claudia.js remain the same as APEX. Make sure your workstation has the AWS secret key and access key supplied in the ~/.aws/credentials file or alternatively provide the basic IAM roles if you are working out off an EC2 instance itself.

Next, install Claudia.js using the following command:

# npm install claudia -g
You will need Node 4.x installed on your local development workstation. You can download the correct Node.js version for your Linux distro from here at https://nodejs.org/en/download/package-manager/.

Next, create a separate work directory and create a simple hello world index.js file as shown as follows:

# vi index.js  
console.log('starting function') 
exports.handle = function(e, ctx, cb) { 
  console.log('processing event: %j', e) 
  cb(null, { hello: 'world' }) 
} 

To deploy the function using Claudia.js, type in the following command:

# claudia create --region us-east-1 --handler index.handle 

Remember to name the --handler parameter correctly to match the module.method format. In this case, the module is index and the method is called handle.

At this point, Claudia.js will validate the code, upload the same to Lambda and create the associated IAM roles as well for execution. Once your code is uploaded successfully, you can invoke the same using just a single command as shown as follows:

# claudia test-lambda

With the deployment and invocation done, you can further make changes to your code and upload newer versions of the same with relative ease. To know more about the various command-line arguments, as well as the packaging options provided by Claudia.js, visit https://claudiajs.com/documentation.html.  With this we come towards the end of this chapter.