Collector 'AWS-Billing (Instance Level)' Configuration Guide¶
Before reading this document, please read:
Tip
Before using this collector, you must install the 'Integration Core Package' and its corresponding third-party dependencies.
Tip
To ensure data integrity, the billing data collected is from the day before the collection date.
Tip
The collector needs to set account_name and account_id in extra_tags.
Tip
Before the first execution of the collector, you need to check Hourly and Resource Level Data in Amazon Web Services Console / Amazon Cost Explorer / Cost Management / Preferences, and wait for 24 hours to obtain the data.
1. Configuration Structure¶
This collector does not require additional configuration.
2. Data Reporting Format¶
After the data is successfully synchronized, you can view the data in the 'Cloud Billing Explorer' of TrueWatch.
An example of the reported data is as follows:
{
"measurement": "cloud_billing",
"tags": {
"billing_id" : "anvxfafakjflxxxxxxx",
"product_code": "Amazon Elastic Compute Cloud - Compute",
"product_name": "Amazon Elastic Compute Cloud - Compute",
"intance_id" : "i-xxxxxxxx",
"billing_date" : "2022-09-09",
"cloud_provider" : "aws",
"account_id" : "xxxxxx",
"account_name": "xxxxxx"
},
"fields": {
"amount" : 9419.23
},
"timestamp": 1657507021
}
Note
The fields in tags and fields may change with subsequent updates.
3. Field Description¶
Reporting Field | API Return Field | API Field Meaning | |
---|---|---|---|
Billing ID | billing_id |
Unique ID of the bill | |
Actual Payment | amount |
BlendedCost |
User payment price |
Product Code | product_code |
Product code | |
Product Name | product_name |
Product name | |
Instance ID | intance_id |
Billing instance ID | |
Billing Period | billing_date |
Date of resource consumption record. Format: YYYY-MM-DD | |
Account Name | account_name |
Account name | |
Account ID | account_id |
Account ID |
4. Interaction with Custom Object Collectors¶
When other custom object collectors (such as EC2, RDS) are running in the same DataFlux Func, this collector will automatically try to match the name
field with the tags.name
field in the custom object. When successfully matched, it will add all fields except name
from the custom object tags
to the billing data tags
.
Assume the original data collected by the billing is as follows:
{
"measurement": "cloud_billing",
"tags": {
"billing_id" : "anvxfafakjflxxxxxxx",
"product_code": "ec2",
"product_name": "Amazon Elastic Compute Cloud - Compute",
"name" : "i-xxxxxxxx",
"billing_date" : "2022-09-09",
"cloud_provider" : "aws",
"account_id" : "xxxxx",
"account_name": "xxxxx"
},
"fields": {
"amount": 9419.23
},
"timestamp": 1657507021
}
At the same time, the custom object data collected by the AWS EC2 collector is as follows:
{
"measurement": "aws_ec2",
"tags": {
"name" : "i-xxxxxxxx",
"InstanceId" : "i-xxxxxxxx",
"RegionId" : "cn-hangzhou",
"{key}" : "{value}"
},
"fields": {
"{key}": "{value}"
}
}
Then, the final reported billing data is as follows:
{
"measurement": "cloud_billing",
"tags": {
"billing_id" : "anvxfafakjflxxxxxxx",
"instance_id" : "i-xxxxxxxx",
"region_id" : "cn-hangzhou",
"product_code": "ec2",
"product_name": "Amazon Elastic Compute Cloud - Compute",
"billing_date" : "2022-09-09",
"cloud_provider" : "aws",
"account_id" : "xxxxx",
"account_name": "xxxxx",
"{key}" : "{value}"
},
"fields": {
"amount": 9419.23,
},
"timestamp": 1657507021
}
5. Cloud Billing API Call Count Explanation¶
The AWS Cost Explorer API call fee is $0.01 per page. The following provides a detailed explanation of the script set call count:
. Find the actual call count by viewing the task execution log:
The collector counts the number of API calls for each task execution result, which can be viewed in the log, for example:
[2023-07-04 11:35:18.497] [+0ms] The [1] account collection is completed, taking [759 milliseconds], during which the API was called [2 times]
[2023-07-04 11:35:18.498] [+0ms] Detailed calls are as follows:
[2023-07-04 11:35:18.498] [+0ms] -> ce.cn-northwest-1.amazonaws.com.cn/?Action=get_dimension_values: 1 time
[2023-07-04 11:35:18.498] [+0ms] -> ce.cn-northwest-1.amazonaws.com.cn/?Action=get_cost_and_usage_with_resources: 1 time