All Products
Search
Document Center

Simple Log Service:ECS bill analysis

Last Updated:May 09, 2025

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.

image

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,region

Example 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
  t

Configure 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.

  1. In the left-side navigation pane, click Alerts. On the Alert Center page, click Create Alert.

    image

  2. On the Create Alert page, configure the related parameters.

    1. Set Check Frequency to Fixed Interval and 1 day. Then, click Create in the Query Statistics field.image

    2. 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

      image

    3. On the Create Alert page, set Trigger Condition to data matches the expression. Then, set the matching condition to Traffic greater than your alert threshold. The example uses an alert threshold of 10. For other parameters, refer to Configuration description.image

  3. After configuring the alert, view alert records on the alert dashboard.