Blocking Amazon Bedrock usage with an AI budget
You can set up an AI budget to block new Amazon Bedrock requests when the budget's spend reaches 100 percent of its limit. When blocking takes effect, AWS Budgets also sends you an alert.
Blocking is available for account-level AI budgets. AI cost budgets for users and groups support notifications and don't block usage.
To turn on blocking for an AI cost budget
-
Create an AI cost budget that meets the Requirements. For the steps, see Creating an AI cost budget.
-
On the Alerts and blocking step, under Block requests, turn on Block Bedrock requests.
-
Select Allow AWS Budgets to block requests with Service Control Policies (SCPs).
-
Finish creating the budget. Blocking takes effect when you create the budget.
Requirements
To block Amazon Bedrock usage with an AI budget, you must meet the following requirements:
-
The budget is an account-level budget. Blocking isn't available for AI cost budgets for users or groups.
-
You create the budget from the management account of an organization in AWS Organizations. You can't block usage from a budget in a member account or a standalone account.
-
Your organization has all features turned on, and service control policies (SCPs) are turned on for the organization root. For more information, see Service control policies (SCPs) in the AWS Organizations User Guide.
-
The budget covers only Amazon Bedrock, with All models selected. Linked account is the only filter that you can use. You can select up to 100 linked accounts. If you choose specific providers or models, or add any other filter, blocking isn't available.
-
You allow AWS Budgets to create the
AWSServiceRoleForBudgetsActionExecutionservice-linked role. For more information, see Service-linked roles for Budgets actions.
How blocking works
Blocking uses two pieces that work together:
-
A service control policy (SCP) enforces the block. An SCP is an AWS Organizations policy that limits what the accounts in your organization can do, so a deny in the SCP stops Amazon Bedrock requests in those accounts.
-
The
AWSServiceRoleForBudgetsActionExecutionservice-linked role lets AWS Budgets create, update, and remove that SCP on your behalf. The role can manage only SCPs that have thebudgets:managedtag. For more information, see Service-linked roles for Budgets actions.
When you turn on blocking for an AI budget, AWS Budgets creates one SCP for
that budget in your organization.
The SCP has the tag budgets:managed with the value
true. AWS Budgets attaches the SCP as follows:
-
If the budget has no linked account filter, AWS Budgets attaches the SCP to the organization root. The SCP then applies to every account in the organization except the management account.
-
If the budget has a linked account filter, AWS Budgets attaches the SCP to each linked account in the filter.
Until the budget reaches its limit, the SCP doesn't deny any actions. When the budget's spend reaches its limit, AWS Budgets updates the SCP to deny the following actions:
-
bedrock:InvokeModel*, which also covers theConverseandConverseStreamoperations -
bedrock:CreateModelInvocationJob -
bedrock-mantle:CreateInference
AWS Budgets updates the SCP so that it doesn't deny any actions, and restores Amazon Bedrock access, in either of the following cases:
-
A new budget period starts, such as a new month for a monthly budget.
-
You increase the budget amount above the current spend.
AWS Budgets sends you a notification when it blocks Amazon Bedrock, when it restores access, and when it can't apply blocking. For example, you get a notification if the service-linked role was deleted, or if the SCP was detached or deleted.
Things to know about blocking
-
SCPs don't apply to the management account. Amazon Bedrock usage in the management account isn't blocked, but it still counts toward the budget's spend.
-
Blocking stops all new Amazon Bedrock model inference requests, including requests that aren't priced by token and aren't tracked in the budget.
-
Blocking stops new requests. It doesn't stop Amazon Bedrock work that is already running, such as Provisioned Throughput or batch inference jobs that already started.
-
If more than one AI budget covers the same account, blocking from any one of those budgets blocks Amazon Bedrock in that account.
-
Each AI budget that blocks Amazon Bedrock uses one SCP on each target that it's attached to. AWS Organizations limits the number of SCPs that you can attach to a root, organizational unit, or account. If AWS Budgets can't attach the SCP to every target, it doesn't turn on blocking and sends you a notification. For more information, see Quotas and service limits for AWS Organizations in the AWS Organizations User Guide.
-
Don't edit, detach, or delete the SCPs that have the
budgets:managedtag. If you do, AWS Budgets might not be able to block Amazon Bedrock usage. -
When you turn off blocking for an AI budget, or delete the budget, AWS Budgets detaches and deletes the SCP for that budget.
-
Standard AWS Budgets pricing applies for action-enabled budgets, including budgets with blocking turned on. For more information, see AWS Budgets pricing
.
Turning on blocking with the API
To turn on blocking with the AWS Budgets API, call CreateBudgetAction with the
action type BLOCK_SERVICE, and specify the service to block in
BlockServiceActionDefinition. The budget must be a
COST budget that uses the
PublicOnDemandCost or
EstimatedContractedCost metric, and it must meet the
requirements in Requirements.