This topic describes how to view the Elastic Compute Service (ECS) bill analysis report, customize query and analysis statements, and configure alerts for ECS traffic usage.
View the ECS bill analysis report
On the Cost Manager page, click ECS Instance Bill Analysis. View the detailed bill information.

Custom analysis of ECS costs
Customize query and analysis statements in Custom Analysis of Cost Manager.
Example 1: Calculate ECS instance-level costs
Use the following query and analysis statement to calculate the cost of each ECS instance:
* | select
instanceId, region,
sum(PretaxAmount) as cost
FROM instance_bill
where
productcode = 'ecs'
group by
instanceId,regionExample 2: Query daily costs for an instance
Use the following query and analysis statement to calculate the daily costs of each billing item for an instance. Replace ${instanceId} with the actual instance ID.
* | select
date_trunc('day', __time__) as t,
billingItem,
sum(PretaxAmount) as cost
FROM instance_bill
where
productcode = 'ecs'
and instanceId = '${instanceId}'
group by
t,
billingItem
order by
tConfigure alerts for ECS traffic usage
Configuring alerts to monitor daily bill costs or usage. The following example shows how to configure an alert when the outbound traffic of an ECS instance exceeds the threshold.
In the left-side navigation pane, click Alerts. On the Alert Center page, click Create Alert.

On the Create Alert page, configure the related parameters.
Set Check Frequency to Fixed Interval and 1 day. Then, click Create in the Query Statistics field.

On the Query Statistics page, select a logstore, set Time Range to Yesterday, and configure the following query analysis statement to query the total cost of the instance yesterday. Then click Confirm.
* | select instanceId, sum(Usage) as "Traffic" FROM instance_bill where productcode = 'ecs' and billingItem = 'Outbound Traffic' group by instanceId
On the Create Alert page, set Trigger Condition to data matches the expression. Then, set the matching condition to
Trafficgreater than your alert threshold. The example uses an alert threshold of 10. For other parameters, refer to Configuration description.
After configuring the alert, view alert records on the alert dashboard.