Is it possible to use the AWS SDK from xMatters?

I should start by explaining that I'm quite the Javascript novice, as might become apparent :)

I'm trying to build some automation within xMatters that will call various AWS APIs. To that end, I'm trying to incorporate the AWS SDK as a library in xMatters.

Since I can't use npm to install the package, I'm left trying to download the browser version of the SDK and save that as a library. So I've gone to aws/aws-sdk-js: AWS SDK for JavaScript in the browser and Node.js (github.com) and then downloaded https://sdk.amazonaws.com/js/aws-sdk-2.794.0.min.js and saved that as a library.

My integration script has this snippet in it:

var AWS = require('aws-sdk');
var ec2 = new AWS.EC2({region: 'us-east-1'});
but the code breaks with this error:
TypeError: AWS.EC2 is not a constructor
So, then I try to use Build your own AWS SDK for JavaScript (amazonaws.com) to build a smaller SDK with just the EC2 portion in it.
The AWS documentation says that it is possible to "require" a subset of the entire SDK, which looks like this:
// Import the Amazon S3 service client
var S3 = require('aws-sdk/clients/s3');

// Set credentials and Region
var s3 = new S3({
apiVersion: '2006-03-01',
region: 'us-west-1',
credentials: {YOUR_CREDENTIALS}
That isn't going to *directly* work with xMatters because it looks like you can only reference the associated library name. So, in my case, I store the smaller library as "aws-sdk-ec2".
Then, with the code looking like this:
var AWS = require('aws-sdk-ec2');
var ec2 = new AWS.EC2({region: 'us-east-1'});
the error is:
Error importing library 'aws-sdk-ec2', line undefined: AWS is not defined
So I'm stuck. Am I trying to achieve something that isn't actually possible in xMatters?
Or is there a solution ... ? :)


Please sign in to leave a comment.