Setting up fleet cost and usage
To show cost and usage on the Observability tab, the spans that Amazon Bedrock AgentCore records in each member account must reach the account that owns your organization-scoped registry. Complete the prerequisites, then turn on CloudWatch trusted access and create a centralization rule.
Prerequisites
Before you begin, make sure that you have the following:
-
An organization-scoped registry with active auto-detection – The registry must be owned by the management account of your organization or by the delegated administrator for AWS Agent Registry, and its auto-detection status must be
ACTIVE. The Observability tab appears only on this registry, and only when you’re signed in to the account that owns it. For setup, see Using AWS Agent Registry with AWS Organizations. -
AgentCore observability in each member account – AgentCore records spans in a member account only when the following are set up there:
-
CloudWatch Transaction Search is turned on in each member account and Region where your agents run. For more information, see Enabling CloudWatch Transaction Search.
-
Tracing is turned on for the AgentCore resources that you want to include, such as runtimes, gateways, and memories. For more information, see Configure observability.
-
To include model inference costs, your agent code is instrumented with the AWS Distro for OpenTelemetry (ADOT), so that each model call records a span with its token usage. For more information, see Get started with AgentCore Observability.
-
-
Cost-stamped spans – AgentCore adds an estimated cost to the spans that it can price. You don’t need to turn this on.
-
CloudWatch Logs centralization in your Region – Your registry’s Region supports CloudWatch Logs centralization. For more information, see Cross-account cross-Region log centralization in the Amazon CloudWatch Logs User Guide.
Turn on fleet cost and usage
You need the permissions in Permissions to set up fleet cost and usage to complete these steps.
Step 1: Turn on CloudWatch trusted access
CloudWatch can copy logs from the accounts in your organization only after you turn on trusted access for CloudWatch in AWS Organizations. Do this from the management account.
To turn on CloudWatch trusted access in the AWS Agent Registry console, do the following:
-
Open the AWS Agent Registry console
, signed in to the management account. -
In the navigation pane, choose Settings.
-
In the CloudWatch organization integration section, choose Edit.
-
Select Enable CloudWatch trusted access, and then choose Save.
Turning on CloudWatch trusted access does the following:
-
Turns on trusted access for CloudWatch (
observabilityadmin.amazonaws.com) in AWS Organizations. -
Creates the service-linked role
AWSServiceRoleForObservabilityAdminin the management account. Amazon CloudWatch defines the role.
To turn on CloudWatch trusted access with the AWS CLI, run the following commands in the management account:
aws organizations enable-aws-service-access \ --service-principal observabilityadmin.amazonaws.com aws iam create-service-linked-role \ --aws-service-name observabilityadmin.amazonaws.com
Trusted access for CloudWatch applies to your whole organization. All of your organization’s centralization rules depend on it, including rules that AWS Agent Registry doesn’t use, so keep it turned on while you use them.
Step 2: Create a centralization rule
Create the rule in the CloudWatch console or with the CloudWatch Observability Admin API, from the management account or from the delegated administrator for CloudWatch. For instructions on creating the rule, see Cross-account cross-Region log centralization in the Amazon CloudWatch Logs User Guide.
The Observability tab uses a rule only if it meets these conditions:
-
Source accounts – The rule’s source is your entire organization.
-
Source Regions – The rule includes the Region of your registry. The tab reads spans only from the registry’s Region.
-
Destination – The rule’s destination is the account that owns your organization-scoped registry, in the registry’s Region.
-
Log groups – The rule copies the log groups that hold AgentCore spans and evaluation results:
-
aws/spans, where CloudWatch Transaction Search writes the spans of AgentCore Gateway, Memory, Runtime, and the tools. -
The log groups whose names start with
/aws/bedrock-agentcore/runtimes/. AgentCore Runtime agents can write their own spans, including their model calls, to the agent’s log group there. For more information, see Span destination for agents hosted in Amazon Bedrock AgentCore runtime. Online evaluation results that you send to the agent’s log group are there too. -
The log groups whose names start with
/aws/bedrock-agentcore/evaluations/, where AgentCore Evaluations writes the results of online evaluation configurations and batch evaluations.If you filter log groups, select all three. For example, use this log group selection criteria:
LogGroupName = 'aws/spans' OR LogGroupName LIKE '/aws/bedrock-agentcore/runtimes/%' OR LogGroupName LIKE '/aws/bedrock-agentcore/evaluations/%'If you send evaluation results to a log group of your own, add that log group to the rule too.
-
The rule copies only spans that arrive after you create it. It doesn’t copy spans that are already in the member accounts.
You can open the CloudWatch console from AWS Agent Registry. On the registry’s Observability tab, or in the CloudWatch organization integration section of Settings, choose Create rule in CloudWatch or Manage rules in CloudWatch.
Step 3: Verify the setup
To verify the setup, do the following:
-
Open the AWS Agent Registry console
, signed in to the account that owns your organization-scoped registry. -
Choose Registries, choose your registry, and then choose the Observability tab.
-
If the setup isn’t complete, the tab shows Set up CloudWatch organization integration and the reason, such as trusted access being off or no healthy centralization rule copying spans into the registry’s account. Fix the issue, and then choose Check again.
-
When the setup is complete, the tab shows the fleet’s cost and usage. The Accounts reporting figure shows how many accounts' spans reached the registry’s account in the last 24 hours, out of the accounts that have an auto-detected agent.
To check a centralization rule’s health, open Settings and find the Centralization rules table in the CloudWatch organization integration section. A new rule shows Provisioning until CloudWatch finishes setting it up, and then Healthy.