cost explorer removing tax nodejs

137 Views Asked by At

When I check for last day of the month I have seen the cost in cost explorer higher than usual, I believe this is a tax.

Therefore I want to remove the tax on last day.

I tried this, but it doesn't work

var params = {
            Granularity: 'DAILY',
            Metrics: [
                'NET_UNBLENDED_COST'
            ],
            Filter: {
                Not: {      
                    Dimensions: {
                      Key: "SERVICE",
                      Values: [ "TAX"]
                    }
                }
            },
            TimePeriod: { 
                End: lastDay,
                Start: firstDay 
            }
        };

var costexplorer = new AWS.CostExplorer({ region: 'us-east-1' });

costexplorer.getCostAndUsage(params, function (err: any, data: any) {
      if (err) {
           console.log(err, err.stack);
           reject();
      } else {
           let result: any = data['ResultsByTime']
           resolve(result); 
            }
        });

Can anyone help me?

1

There are 1 best solutions below

0
Avner Sorek On

I've also ran the exact same thing. The Values are case sensitive so you need to write TAX as Tax. There also an option to make it case insensitive.