How to use the CostExplorer function from aws-sdk

Find comprehensive JavaScript aws-sdk.CostExplorer code examples handpicked from public code repositorys.

5266
5267
5268
5269
5270
5271
5272
5273
5274
    ...sqlAwsClientRes[index]
  };
});

let forecastPromise = credentialsList.map(single_client => {
  let costexplorer = new AWS.CostExplorer({ region: "us-east-1", accessKeyId: single_client['accesstoken'], secretAccessKey: single_client['secretekey'] });
  return awsExternalServices.getCostForecastDetails(costexplorer, next_month_start, next_month_end, {});
});
let forecasts = await Promise.all(forecastPromise.map(p => p.catch(e => e)));
fork icon0
star icon0
watch icon0

+ 5 other calls in file

34
35
36
37
38
39
40
41
42
43
44
45
  logStdout.write(util.format.apply(null, arguments) + '\n');
};


console.error = console.log; 


const ce = new AWS.CostExplorer();
ce.getCostAndUsage(params, function (err, data) {
    if (err) console.log(err, err.stack);
    else {
        data.ResultsByTime.forEach(result => {
fork icon0
star icon0
watch icon0

158
159
160
161
162
163
164
165
166
167
168
169
170
  console.error(`\u001b[31m Generation report has error: ${error}`);
});


// ---- Logic part ---- //
async function generateCostReport () {
  const costExplorer = new AWS.CostExplorer();


  console.log('\u001b[32m  The process of generation a cost report is starting ...');


  return Promise.allSettled([
fork icon0
star icon0
watch icon0