Split bills

更新时间:
复制 MD 格式

Function Compute provides a tagging feature that allows you to search for and group functions. After you create tags for your functions, you can use these tags for billing management and to split bills.

Scenarios

Bill splitting applies to the following scenarios:

  • Environment isolation

    You can bind different tags to different environments such as production and test environments, runtimes such as Java, Python, and Node.js runtimes, or client platforms such as iOS and Android to isolate operating environments of developers.

  • Project management

    In team or project management, you can add tags for groups, projects, or departments, such as team:ops, for project-based or team-based billing management.

image

Procedure

image

Before you start

Create a function and add tags to the function. For more information, see Function creation and Configure tags.

Note
  • For functions created in the Function Compute 2.0 console (names that contain a dollar sign, $), tags are bound to the service, not the function.

  • The examples in this topic include functions from both Function Compute 2.0 and 3.0. The tags 2.0:dev, 3.0:dev, team:dev, 2.0:ops, 3.0:ops, and team:ops are bound to the corresponding 2.0 services and 3.0 functions.

Procedure

Enable cost allocation tags

Log on to the Expenses and Costs console. In the left-side navigation pane, choose Cost allocation tags. On the Cost allocation tags page, enable the required cost allocation tags.

  • If you have never enabled tags:

    1. On the Cost allocation tags page, click Next.

    2. In the Select tags that you want to enable. section, search for and add the target tags, and then click Next.

    3. Click Enable. In the Notice dialog box, click OK.

  • If you have enabled tags before:

    1. On the Cost allocation tags page, enter the target tag in the Tag Key field and click Search.

    2. In the search results, find the target tag and click Enable in the Actions column.

      You can also select multiple tags and click Batch Enable to enable them at the same time.

Note
  • After a new tag is created for a function, it is synchronized to the cost allocation tag list on the next day (T+1). You can enable the tag only after it is synchronized.

  • Only enabled tags are visible in the cost center.

Create a cost center

Go to the Cost Centers page. Click the image icon next to Cost Centers to add a new one. On the Cost Centers management page, the left-side navigation pane includes Overview, All Resources, and Unallocated Resources. A tree structure of your cost centers is displayed below. Click + to add a cost center. The Overview area on the right shows the number of cost centers. The Settings area contains the Automatic allocation rules apply to all resources and Aggregate amounts by cost center hierarchy switches, along with an Edit Rule entry for ECS-associated resource allocation settings.

Configure cost center rules

You can use automatic allocation rules for cost centers to automatically assign resource instances that meet specific criteria to a designated cost center.

  1. Click the newly created cost center, select the Automatic Allocation Rule tab, and click Create Rule. Alternatively, select an existing cost center and click Edit on the Automatic Allocation Rule tab.

  2. Configure the conditions and formula.

    For the "Production Environment" cost center, three conditions are set with an OR relationship. A resource is assigned to the "Production Environment" cost center if it meets any of these conditions, for example, if the tag is 2.0:dev, 3.0:dev, or team:dev.

(Optional) Configure automatic resource allocation

Enabling the "Automatic allocation rules apply to all resources" switch ensures that adjustments to a cost center's automatic allocation rules will apply to all cloud resource instances that are not manually allocated. Otherwise, the automatic allocation rules for a cost center apply only to new and unallocated resources.

You can also manually assign resources to cost centers. Manual allocations take precedence over automatic allocations. For more information, see Cost Centers.

Verify the bill splitting results

In the left-side navigation pane, choose Split Bill. On the Split bill details page, view the bill splitting information.

In the Cost Center column, filter for the target cost center, such as "Production Environment". Then, verify that the correct resources are assigned to this cost center by checking the Asset/Resource Instance ID column.

Also, check the Instance tags column to confirm that the tags for each resource instance, such as key:team value:dev, are as expected.

Related documents