I just used the new feature Add JS Libraries
and added the recommended Library AWS SDK for JavaScript.
Followed the code given in the examples (browser):
metrics: async () => {
AWS.config.region = 'eu-west-3';
AWS.config.credentials = new AWS.Credentials("SECRET","SECRET");
var cw = new AWS.CloudWatch({apiVersion: '2010-08-01'});
var params = {
Dimensions: [
{
Name: 'LogGroupName', /* required */
},
],
MetricName: 'IncomingLogEvents',
Namespace: 'AWS/Logs'
};
cw.listMetrics(params, function(err, data) {
if (err) {
console.log("Error", err);
} else {
console.log("Metrics", JSON.stringify(data.Metrics));
}
});
}
but got an error when executing directly from the EDIT window:
"message":"XMLHttpRequest is not a constructor"
"code":"NetworkingError"
any clue???