处理账户预算

账户预算监控账户中所有 Credit 使用量的支出。

激活账户预算

要开始使用 Budgets 来监控账户的 Credit 使用量,请激活账户预算。激活账户预算后,您可以设置账户的支出限额,并配置通知的发送方式,以便在 Credit 使用量超过支出限额时接收通知。当预计支出比支出限额高出 10% 以上时,通知开始生效。

You can activate the account budget by using Snowsight or by executing SQL statements.

接下来的各部分介绍如何激活账户预算:

创建自定义角色以管理账户预算

您可以创建自定义角色以激活和修改账户预算。被授予此角色的用户可以通过对账户预算采取以下操作来管理预算:

  • 激活和停用账户预算。
  • 设置支出限额。
  • 编辑通知设置。
  • 监控账户的 Credit 使用量。

For a full list of roles and privileges required for the budget administrator role, see Budgets roles and privileges.

The following example creates a role named account_budget_admin and grants the role the ability to monitor and manage the account budget:

USE ROLE ACCOUNTADMIN;

CREATE ROLE account_budget_admin;

GRANT APPLICATION ROLE SNOWFLAKE.BUDGET_ADMIN TO ROLE account_budget_admin;

GRANT IMPORTED PRIVILEGES ON DATABASE SNOWFLAKE TO ROLE account_budget_admin;

Use Snowsight to activate the account budget

Note

Only a user with the ACCOUNTADMIN role or a role granted account budget admin privileges can activate and set up the account budget for a regular account.

If you are activating the account budget for the organization account, use the GLOBALORGADMIN role instead of the ACCOUNTADMIN role.

  1. Sign in to Snowsight.

  2. In the navigation menu, select Admin » Cost management.

  3. Select Budgets.

  4. 如果出现提示,请选择一个仓库。

  5. In the dashboard, select Set up Account Budget.

  6. 输入账户的目标支出限额。

  7. 输入用于接收通知电子邮件的电子邮件地址。

    Note

    Each email address added for budget notifications must be verified. The notification email setup fails if any email address in the list is not verified.

  8. Select Finish Setup.

使用 SQL 命令激活账户预算

Note

Only a user with the ACCOUNTADMIN role or a role granted account budget admin privileges can activate and set up the account budget in a regular account.

If you are activating the account budget for the organization account, use the GLOBALORGADMIN role instead of the ACCOUNTADMIN role.

  1. Activate the account budget by calling the account_root_budget!ACTIVATE method on the SNOWFLAKE.LOCAL.ACCOUNT_ROOT_BUDGET object:

    CALL SNOWFLAKE.LOCAL.ACCOUNT_ROOT_BUDGET!ACTIVATE();
  2. Set the spending limit calling the <budget_name>!SET_SPENDING_LIMIT method:

    CALL SNOWFLAKE.LOCAL.ACCOUNT_ROOT_BUDGET!SET_SPENDING_LIMIT(1000);
  3. Set up notifications for the budget so that you receive notifications when your credit usage is expected to exceed your spending limits.

    See Notifications for budgets.

停用账户预算

You can deactivate the account budget using Snowsight or SQL.

停用账户预算会将账户预算重置为激活前的状态:

  • 将删除所有历史账户预算数据。
  • 账户预算的背景测量任务已暂停。
  • 将重置支出限额和电子邮件通知的账户预算设置。

Account budget deactivation does not affect custom budgets. To remove a custom budget from your account, use the DROP BUDGET command.

Note

If the account budget is deactivated, you can’t create new custom budgets using Snowsight. However, you can continue to create custom budgets using SQL.

Use Snowsight to deactivate the account budget

You can deactivate the account budget using the Budgets page:

  1. Sign in to Snowsight.
  2. In the navigation menu, select Admin » Cost management.
  3. Select Budgets.
  4. Select the Three vertical dots indicating more options more menu.
  5. Select Deactivate account budget.

使用 SQL 命令停用账户预算

You can use the account_root_budget!DEACTIVATE method to deactivate the account budget:

CALL SNOWFLAKE.LOCAL.ACCOUNT_ROOT_BUDGET!DEACTIVATE();