Get cost items per resource pool
Obtains the cost items for a specified interval according to resource pools. The interval can be monthly, yearly, half-yearly, and quarterly.
Request details
HTTP method: GET
Request URL: https://<host_name>/cloudcost/api/v1/cost/resource_costs/aggregate/by_pool/<resource_pool_ID>
Example: https://portal.us1.onbmc.com/cloudcost/api/v1/cost/resource_costs/aggregate/by_pool/<resource_pool_ID>
Header: See HTTP request and response headers for header information, such as required authorization token.
Query parameters:
Property | Type | Required | Description |
---|---|---|---|
start | Long | Yes | The date (in msec epoch time (GMT)) from when you want to view the cost items per resource pool. |
end | Long | Yes | The date (in msec epoch time (GMT)) up to when you want to view the cost items per resource pool. |
size | Integer | No | The number of cost items that you want to fetch. The default is 20. Any integer greater than 0 is accepted. |
from | Integer | No | The range of cost items to be fetched. The default is 0. Any integer that is 0 or greater is accepted. For example, if the available cost items are 100 and you specify size as 10 and from as 1, the response will contain the first 10 cost items. |
details | Boolean | No | A Boolean value that indicates whether you want to obtain the aggregated cost of each resource in the resource pool. The default is false, which returns the aggregated cost across all the resources per resource pool. If the value is set to true, the response includes the aggregated cost for each resource in the resource pool. |
Sample response
Response with details set to true:
"resources": [
{
"cost": 133.65,
"account_id": "123438742567",
"account_name": "aws_account",
"provider_id": "aws",
"provider_name": "aws",
"resource_id": "1234567",
"name": "abcdxyz1234",
"service_id": "AmazonEC2",
"region": "us-east-1",
"tags": [
{
"key": "aws:createdBy",
"value": "IAMUser:test@bmc.com"
},
{
"key": "Name",
"value": "LCDOverallocated09"
},
{
"key": "cost-bearer",
"value": "region1,region2,region3"
},
{
"key": "cost-percentage",
"value": "10,10,80"
},
{
"key": "cost-ratio",
"value": "2,1,0"
}
],
"bmc_tags": null,
"properties": {
"actual_resource_id": "i-0e221a43e446c2f08",
"associatedVolumes": [
"767138742521:vol-09a45c1e018ede3af"
],
"usage-amount": 111.3,
"instance-type": "t2.xlarge",
"availability-zone": "us-east-1c"
},
"connector_id": "",
"app_id": "",
"sku": "DDCWVHKZ3AJBNv67",
"type": "Compute Instance",
"license_type": "",
"master_account_id": "765775313223",
"created_at": 2278301200000,
"service_name": "Amazon Elastic Compute Cloud",
"category": "resource",
"resource_pool_ids": [
"9978-c6ed-f501-5555-a3a0-0e4402ca4518"
],
"state": null
}
],
}
Response with details set to false:
"total_cost": 2089.53
}
Status codes and messages
HTTP code | Description |
---|---|
200 | OK |
401 | Unauthorized |
400 | Bad request |
403 | Forbidden |