monthly_cost_attribution
Creates, updates, deletes, gets or lists a monthly_cost_attribution resource.
Overview
| Name | monthly_cost_attribution | 
| Type | Resource | 
| Id | datadog.cloud_costs.monthly_cost_attribution | 
Fields
The following fields are returned by SELECT queries:
- get_monthly_cost_attribution
| Name | Datatype | Description | 
|---|---|---|
| id | string | Unique ID of the response. | 
| attributes | object | Cost Attribution by Tag for a given organization. | 
| type | string | Type of cost attribution data. (default: cost_by_tag, example: cost_by_tag) | 
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description | 
|---|---|---|---|---|
| get_monthly_cost_attribution | select | start_month,fields,region | end_month,sort_direction,sort_name,tag_breakdown_keys,next_record_id,include_descendants | Get monthly cost attribution by tag across multi-org and single root-org accounts. Cost Attribution data for a given month becomes available no later than the 19th of the following month. This API endpoint is paginated. To make sure you receive all records, check if the value of next_record_idisset in the response. If it is, make another request and pass next_record_idas a parameter.Pseudo code example: <br />response := GetMonthlyCostAttribution(start_month, end_month)<br />cursor := response.metadata.pagination.next_record_id<br />WHILE cursor != null BEGIN<br />  sleep(5 seconds)  # Avoid running into rate limit<br />  response := GetMonthlyCostAttribution(start_month, end_month, next_record_id=cursor)<br />  cursor := response.metadata.pagination.next_record_id<br />END<br />This endpoint is only accessible for parent-level organizations. This endpoint is not available in the Government (US1-FED) site. | 
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description | 
|---|---|---|
| fields | string | Comma-separated list specifying cost types (e.g., <billing_dimension>_on_demand_cost,<billing_dimension>_committed_cost,<billing_dimension>_total_cost) and the proportions (<billing_dimension>_percentage_in_org,<billing_dimension>_percentage_in_account). Use*to retrieve all fields. Example:infra_host_on_demand_cost,infra_host_percentage_in_accountTo obtain the complete list of active billing dimensions that can be used to replace<billing_dimension>in the field names, make a request to the Get active billing dimensions API. | 
| region | string | (default: datadoghq.com) | 
| start_month | string (date-time) | Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM]for cost beginning in this month. | 
| end_month | string (date-time) | Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM]for cost ending this month. | 
| include_descendants | boolean | Include child org cost in the response. Defaults to true. | 
| next_record_id | string | List following results with a next_record_id provided in the previous query. | 
| sort_direction | string | The direction to sort by: [desc, asc]. | 
| sort_name | string | The billing dimension to sort by. Always sorted by total cost. Example: infra_host. | 
| tag_breakdown_keys | string | Comma separated list of tag keys used to group cost. If no value is provided the cost will not be broken down by tags. To see which tags are available, look for the value of tag_config_sourcein the API response. | 
SELECT examples
- get_monthly_cost_attribution
Get monthly cost attribution by tag across multi-org and single root-org accounts.
Cost Attribution data for a given month becomes available no later than the 19th of the following month.
This API endpoint is paginated. To make sure you receive all records, check if the value of next_record_id is
set in the response. If it is, make another request and pass next_record_id as a parameter.
Pseudo code example:<br />response := GetMonthlyCostAttribution(start_month, end_month)<br />cursor := response.metadata.pagination.next_record_id<br />WHILE cursor != null BEGIN<br />  sleep(5 seconds)  # Avoid running into rate limit<br />  response := GetMonthlyCostAttribution(start_month, end_month, next_record_id=cursor)<br />  cursor := response.metadata.pagination.next_record_id<br />END<br />
This endpoint is only accessible for parent-level organizations. This endpoint is not available in the Government (US1-FED) site.
SELECT
id,
attributes,
type
FROM datadog.cloud_costs.monthly_cost_attribution
WHERE start_month = '{{ start_month }}' -- required
AND fields = '{{ fields }}' -- required
AND region = '{{ region }}' -- required
AND end_month = '{{ end_month }}'
AND sort_direction = '{{ sort_direction }}'
AND sort_name = '{{ sort_name }}'
AND tag_breakdown_keys = '{{ tag_breakdown_keys }}'
AND next_record_id = '{{ next_record_id }}'
AND include_descendants = '{{ include_descendants }}'
;