I am trying to fetch all the instance types for EC2 from EC2 SDK JSON
const instanceEnums = require('aws-sdk/apis/ec2-2016-11-15.normal.json');
function getAllTypes(property) {
return instanceEnums.shapes[property].enum;
}
getAllTypes('InstanceType')
But It throws an error that
cannot find module aws-sdk/apis/ec2-2016-11-15.normal.json
I realized that the installed SDK/module does not include the .normal.json file but only .min.js file.
Is there any other way to access the files from apis folder same as we can access clients folder just by requiring SDK and AWS.EC2 and all(as sdk exports the clients folder's files from index.js.)
I need to use something like explained as in this answer https://stackoverflow.com/a/42494509/9381809
from How to require/read the JSON files from aws-sdk apis folder
No comments:
Post a Comment