Suppose I have organization and I want to get the cost as per account wise. How can I get it?
I am using aws-sdk
for nodejs. how can I List all account and get the cost account wise?
I am using AWS lambda for this. Any help would highly be appreciated.
I am trying to use below with an single account but I am not able to set Dimension, AND I am helpless with online resource
var params = {
Granularity: DAILY | MONTHLY | HOURLY, /* required */
Metric: BLENDED_COST | UNBLENDED_COST | AMORTIZED_COST | NET_UNBLENDED_COST | NET_AMORTIZED_COST | USAGE_QUANTITY | NORMALIZED_USAGE_AMOUNT, /* required */
TimePeriod: { /* required */
End: 'STRING_VALUE', /* required */
Start: 'STRING_VALUE' /* required */
},
Filter: { /* Expression */
And: [
/* recursive Expression */,
/* more items */
],
CostCategories: {
Key: 'STRING_VALUE',
MatchOptions: [
EQUALS | ABSENT | STARTS_WITH | ENDS_WITH | CONTAINS | CASE_SENSITIVE | CASE_INSENSITIVE,
/* more items */
],
Values: [
'STRING_VALUE',
/* more items */
]
},
Dimensions: {
Key: AZ | INSTANCE_TYPE | LINKED_ACCOUNT | LINKED_ACCOUNT_NAME | OPERATION | PURCHASE_TYPE | REGION | SERVICE | SERVICE_CODE | USAGE_TYPE | USAGE_TYPE_GROUP | RECORD_TYPE | OPERATING_SYSTEM | TENANCY | SCOPE | PLATFORM | SUBSCRIPTION_ID | LEGAL_ENTITY_NAME | DEPLOYMENT_OPTION | DATABASE_ENGINE | CACHE_ENGINE | INSTANCE_TYPE_FAMILY | BILLING_ENTITY | RESERVATION_ID | RESOURCE_ID | RIGHTSIZING_TYPE | SAVINGS_PLANS_TYPE | SAVINGS_PLAN_ARN | PAYMENT_OPTION | AGREEMENT_END_DATE_TIME_AFTER | AGREEMENT_END_DATE_TIME_BEFORE,
MatchOptions: [
EQUALS | ABSENT | STARTS_WITH | ENDS_WITH | CONTAINS | CASE_SENSITIVE | CASE_INSENSITIVE,
/* more items */
],
Values: [
'STRING_VALUE',
/* more items */
]
},
Not: /* recursive Expression */,
Or: [
/* recursive Expression */,
/* more items */
],
Tags: {
Key: 'STRING_VALUE',
MatchOptions: [
EQUALS | ABSENT | STARTS_WITH | ENDS_WITH | CONTAINS | CASE_SENSITIVE | CASE_INSENSITIVE,
/* more items */
],
Values: [
'STRING_VALUE',
/* more items */
]
}
},
PredictionIntervalLevel: 'NUMBER_VALUE'
};
costexplorer.getCostForecast(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});