<repo_name>aalmacin/salsa-dashboard<file_sep>/README.md
# Requirements
You need to have AWS **Access Key** and **Secret Access Key** with the right permissions. And create the following environment variables
* HACK_HOUR_ACCESS_KEY
* HACK_HOUR_ACCESS_SECRET
<file_sep>/index.js
const AWS = require('aws-sdk');
const cost = new AWS.CostExplorer({
  accessKeyId: process.env.HACK_HOUR_ACCESS_KEY,
  secretAccessKey: process.env.HACK_HOUR_ACCESS_SECRET,
  region: 'us-east-1'

});

const params = {
  TimePeriod: {
    End: '2019-01-01',
    Start: '2018-01-01'
  },
  Granularity: 'MONTHLY',
  Metrics: ['BlendedCost', 'UnblendedCost', 'UsageQuantity'],
  GroupBy: [
    {
      Type: "DIMENSION",
      Key: "REGION"
    }
  ]
};


cost.getCostAndUsage(params, function(err, data) {
  data.ResultsByTime.map((result) => {
    result.Groups.map((group) => {
      console.log(group);
    })
  })
})
