Amazon Bedrock AgentCoreを使用したFinOpsエージェントの構築
AWS公式ブログ記事で、Amazon Bedrock AgentCoreを用いてFinOpsエージェントを構築する方法を紹介し、Claude Sonnet 4.5やMCPを活用して複数AWSアカウントの費用管理を自然言語で一元化・自動化する実装ガイドを提供している。
キーポイント
Bedrock AgentCoreを活用したFinOpsエージェント構築
AWS Cost Explorer、Budgets、Compute Optimizerのデータを統合し、自然言語クエリで費用分析と最適化を一元化する。
Claude Sonnet 4.5とStrands SDKによるエージェント開発
Anthropicの最新モデルとStrands Agent SDK、Model Context Protocol (MCP) を組み合わせて高度なツール呼び出しを実現。
AWS CDKとAmplify/Cognitoによる安全なデプロイ
Infrastructure as Codeでアーキテクチャを構築し、AmplifyとCognitoで認証・フロントエンドを提供する。
30日間の会話メモリと20以上の専門ツール
複数アカウントにまたがるコスト管理を支援する長期コンテキスト保持と豊富な専用ツールセットを提供。
影響分析・編集コメントを表示
影響分析
AWSがAgentCoreとMCPを推進する中で、FinOps領域への適用事例を示すことで、エンタープライズにおけるAIエージェントの実装基準を定義する。既存のクラウド管理コンソールに自然言語インターフェースと長期記憶を組み合わせたこのアプローチは、コスト最適化プロセスの自動化と民主化を加速させる。
編集コメント
AWS公式チュートリアルではあるが、MCPとStrands SDKの採用により、エージェント開発の標準化が進んでいる兆候が見える。実務レベルでのFinOps自動化ニーズに応える実用的なガイドラインとして、社内AI導入の参考になる。
複数の AWS アカウントにわたるコスト管理では、支出の全体像と最適化の機会を把握するために、財務チームが複数のソースからデータを照会する必要が生じることがよくあります。本記事では、Amazon Bedrock AgentCore を活用した FinOps エージェントの構築方法について解説します。このエージェントは、財務チームが複数のアカウントにわたる AWS コストを管理するのを支援し、AWS Cost Explorer、AWS Budgets、および AWS Compute Optimizer からデータを統合して単一のインターフェースに集約します。これにより、チームは「今月の主要なコストドライバーは何ですか?」といった質問を行い、即座に回答を得ることができます。
本記事では、アーキテクチャのセットアップ方法、AWS Cloud Development Kit (AWS CDK) を用いたソリューションのデプロイ方法、および自然言語による照会を通じてコストデータと対話する方法を学びます。このソリューションは、AgentCore、Anthropic Claude Sonnet 4.5、Strands Agent SDK、および Model Context Protocol (MCP) を活用しています。
30 日間のコンテキストを保持する会話メモリが用意されるため、情報を繰り返すことなく追跡質問を行うことができます。分析から最適化までコスト管理の全範囲をカバーする 20 以上の専門ツールにより、複数の AWS コンソールを手動で移動する必要が軽減されます。自然言語による対話機能により、組織内のチームメンバー全員がコストデータにアクセスできるようになります。
ソリューション概要
このソリューションは、主に認証およびフロントエンド層と、ツールおよびメモリを備えた Amazon Bedrock AgentCore Runtime の 2 つの主要コンポーネントで構成されています。Amazon Cognito がユーザー認証を管理し、AgentCore Runtime がコスト管理クエリを処理します。認証およびフロントエンド層は、Web アプリケーションインターフェースのホストに AWS Amplify を、ユーザー認証に Amazon Cognito を使用しています。Amazon Cognito はユーザー認証を担当し、Identity Pools を通じて一時的な AWS クレデンシャルを提供します。
FinOps 用のカスタムエージェントは AgentCore Runtime にホストされ、Amazon Bedrock と統合された Strands エージェントを用いて構築されています。これにより Large Language Model (LLM)(大規模言語モデル)へのアクセスが可能になります。Amazon Bedrock AgentCore Gateway は、ツールの呼び出しを管理し、AWS Identity and Access Management (IAM)(アイデンティティおよびアクセス管理)認証を用いてリクエストをバックエンドサービスへルーティングします。MCP サーバーは AgentCore Runtime にホストされ、AWS の請求書およびコスト管理ツールへのアクセスを提供します。AgentCore Memory は、最大 30 日間のコンテキスト保持のために会話履歴を維持します。
AgentCore Identity は、Gateway と MCP サーバーランタイム間の安全な通信のための OAuth 2.0 認証情報のライフサイクルを管理します。これは Amazon Cognito の M2M クライアント認証情報を OAuth 認証情報プロバイダーとして保存し、Gateway が MCP ランタイムとの認証を必要とする際に Gateway に代わってトークンを発行します。
これらのコンポーネントが整ったことで、以下のセクションではこれらが完全なアーキテクチャにおいてどのように連携して動作するかを検証します。
アーキテクチャ図
以下の図は、5 つの主要なセクションを含むソリューションアーキテクチャを表しています。
セクション A – 認証インフラストラクチャ:まず、FinOpsAuthStack CDK スack が認証インフラストラクチャ(Amazon Cognito ユーザープール、アイデンティティプール、M2M クライアント、リソースサーバー、および IAM ロール)をデプロイします。ユーザープールはユーザー認証を処理し、M2M クライアントはゲートウェイと MCP ランタイム間のマシンツーマシン OAuth 2.0 フローを可能にし、アイデンティティプールはフロントエンドアプリケーションが AgentCore ランタイムと安全に通信できるよう一時的な AWS 資格情報を提供します。
セクション B – イメージビルドインフラストラクチャ:次に、FinOpsImageStack CDK スack がコンテナイメージビルドパイプライン(Amazon S3 バケット、AWS CodeBuild プロジェクト、および Amazon Elastic Container Registry (Amazon ECR) リポジトリ)をデプロイします。CodeBuild はアップストリームの AWS Labs MCP サーバーをクローンし、stdio-to-HTTP 変換(streamable-http トランスポート用にパッチ適用)を適用して、AWS Graviton (ARM64) コンテナイメージをビルドし、AgentCore ランタイムで使用するために Amazon ECR に格納します。
セクション C – MCP サーバーランタイム**: FinOpsMCPRuntimeStack CDK スack は、変換された AWS Labs MCP サーバー(請求と価格)を実行する 2 つの AgentCore ランタイムをデプロイします。各ランタイムは、AuthStack の Amazon Cognito を使用した JWT 認証で構成されており、アクセスする AWS API ごとに特定の IAM 権限が付与されています。具体的には、請求用ランタイムには AWS Billing and Cost Management および AWS Compute Optimizer が、価格用ランタイムには AWS Pricing が該当します。
セクション D – AgentCore Gateway**: FinOpsAgentCoreGatewayStack CDK スack は、AWS_IAM 認証、OAuth 資格情報プロバイダ(AuthStack の Cognito M2M 資格情報を使用して AgentCore Identity に登録済み)、および請求用と価格用のランタイムを指す 2 つの MCP サーバーターゲットを持つ AgentCore Gateway をデプロイします。このゲートウェイは、統一されたツール発見および呼び出しエンドポイントを提供し、MCP ランタイムへの外部認証のための OAuth トークン交換を処理します。
セクション E – メインエージェントランタイム**: 最後に、FinOpsAgentRuntimeStack CDK スack はメインの AgentCore ランタイムをデプロイします。これは Strands エージェントフレームワークと Claude Sonnet 3.7 を使用して、ゲートウェイを通じてモデル呼び出しとツール呼び出しをオーケストレーションします。また、会話履歴用の AgentCore Memory もデプロイされます。このランタイムは IAM SigV4 認証でゲートウェイに接続し、両方の MCP サーバーから 24 のツールを発見し、コスト、請求、価格データの取得のためにツールリクエストをゲートウェイ経由でルーティングします。
ウェブアプリケーションの使用
アーキテクチャを理解したところで、サンプルのリクエストフローを追ってみましょう。例えば、ユーザーが「2026 年 1 月の AWS コストはいくらですか?」と質問した場合、どのような処理が行われるのでしょうか?
- FinOps ユーザーは、フロントエンド(HTML、CSS、JavaScript)を提供する AWS Amplify にホストされた Web アプリケーションにアクセスします。
- ユーザーは Amazon Cognito で認証を行います。Amazon Cognito は資格情報を検証し、Identity Pool から一時的な AWS 資格情報を返します。
- フロントエンドはユーザーの質問を AgentCore Runtime に送信し、取得した一時的な AWS 資格情報を使用して InvokeAgentRuntime を呼び出します。
- ランタイム内の Strands エージェントは、その質問と利用可能な 24 のツール定義(tool definitions)を Amazon Bedrock 上の Claude Sonnet 4.5 に送ります。モデルは質問を分析し、billingMcp__cost_explorer というツールの呼び出しが必要であると判断します。
- エージェントはモデルからのツール呼び出しリクエストを受け取り、IAM SigV4 認証(InvokeGateway)を使用して AgentCore Gateway にルーティングします。
- ゲートウェイは MCP ランタイムと認証を行う必要があります。登録された資格情報プロバイダー(Cognito M2M クライアント資格情報によってバックアップされる)を使用して AgentCore Identity に連絡し、OAuth 2.0 トークンを取得します。
- ゲートウェイは OAuth トークンを付与した MCP ツール/呼び出しリクエストを Billing MCP Runtime に送信します。
- Billing MCP Runtime は実行ロールを使用して AWS Cost Explorer に対して実際の API 呼び出しを実行し、2026 年 1 月のコストおよび使用量データを要求します。
- コストデータはチェーンを通じて戻ってきます。Billing MCP Runtime がゲートウェイにレスポンスし、その後ゲートウェイがエージェントにレスポンスします。エージェントはそのコストデータを Amazon Bedrock に返し、Claude が 2026 年 1 月のコストに関する自然言語の要約を生成します。
- 整形されたレスポンスは FinOps ユーザーに戻され、チャットインターフェース内でコストの内訳が表示されます。
前提条件
開始する前に、以下の項目が準備できていることを確認してください:
- Amazon Bedrock、AgentCore、Amazon ECR、AWS Lambda、Amazon Cognito、AWS CodeBuild、および IAM に対する適切な権限を持つ AWS アカウント
- 認証情報を設定した AWS Command Line Interface (AWS CLI)(v2.x)
- Node.js(v18 以降)と npm のインストール済み
- Python 3.13 以上のインストール済み
- AWS CDK が AWS アカウントにインストールされ、ブートストラップされていること
インストール:npm install -g aws-cdk
ブートストラップ:cdk bootstrap aws://AWS-ACCOUNT-NUMBER/AWS-REGION
AWS CDK を使用してソリューションをデプロイする
このソリューションは us-east-1 AWS リージョンにデプロイされます。デプロイには AWS CDK が使用され、3 つの AWS CloudFormation スacks を通じてインフラストラクチャがプロビジョニングされます。
ソリューションをデプロイするには:
ステップ 1: リポジトリをクローンする
git clone https://github.com/aws-samples/sample-finops-agent-amazon-bedrock-agentcore
cd sample-finops-agent-amazon-bedrock-agentcore
ステップ 2: 環境変数を設定する
一時的な管理者パスワードを受け取るために、your-email@example.com を自分のメールアドレスに置き換えてください:
export ADMIN_EMAIL="your-email@example.com"
ステップ 3: CDK を使用してデプロイする
cd cdk && npm install && npm run build && npx cdk bootstrap && npx cdk deploy --all --require-approval never
デプロイスクリプトは、CDK の依存関係をインストールし、TypeScript コードをビルドし、必要に応じて CDK をブートストラップした後、3 つのスタックを順次デプロイします。このプロセスには約 15〜20 分かかります。完了すると、アカウント内に 5 つの CloudFormation スタックが作成されます。
最後の CloudFormation スタック FinOpsAgentRuntimeStack のデプロイが完了したら、ターミナルから以下の出力を確認してください:
- User Pool Id – Cognito Identity Pool ID(Cognito アイデンティティプール ID)
- User Pool Client Id – Cognito User Pool Client ID(Cognito ユーザープールクライアント ID)
- Identity Pool Id – Identity Pool ID(アイデンティティプール ID)
- AgentCore ARN – AgentCore runtime ARN(AgentCore ランタイム ARN)
以下のスクリーンショットは、Outputs がどのように表示されるかを示しています。
管理者ユーザーの一時パスワードを含むメールが送信されます。
インフラストラクチャがデプロイされたので、これで Web アプリケーションを設定して使用し、コストデータと対話できるようになります。
Amplify アプリケーションのデプロイ
AWS Amplify でホストされるサンプルフロントエンドを提供していますが、このソリューションを独自のカスタムフロントエンドに統合したり、既存のエンタープライズコミュニケーションツールに接続したりすることも可能です。フロントエンドアプリケーションは、GitHub リポジトリのコードを使用して手動でデプロイする必要があります:
- GitHub からフロントエンドコード AWS-Amplify-Frontend.zip をダウンロードします。
- AWS Management Console で AWS Amplify に移動します。
- Git プロバイダーなしでのデプロイを選択します。
- アプリケーションの .zip ファイルをアップロードします。
- デプロイが完了するまで待ちます。
- 生成されたドメイン URL をメモします。
MCP サーバーの理解
MCP サーバー(AWS Billing and Cost Management MCP Server および AWS Pricing MCP Server)は、コスト管理および価格設定のツールを提供します。各 MCP サーバーは特定の種類のクエリを処理するように設計されています。AWS Billing and Cost Management MCP サーバーは、実際の AWS アカウントデータを用いた過去の支出分析、予算モニタリング、コスト異常検知、最適化推奨事項に焦点を当てています。一方、AWS Pricing MCP サーバーは、AWS Price List API からのリアルタイム価格データを取得することで、将来を見据えたクエリを処理し、新しいワークロードやインフラストラクチャ・アズ・コード(IaC)プロジェクトのコスト見積もりを可能にします。
ウェブアプリケーションの使用
AWS Amplify アプリケーションを作成した後に提供される URL を開きます。Amazon Cognito および AgentCore の設定詳細を入力するよう求められます。スタック出力から取得した値(事前に収集済み)を入力してください。「Agent Type」メニューから AgentCore Agent を選択し、デプロイ先のリージョンを入力します。さらに、エージェント名を選択してください(本例では AgentCore Agent を使用)。以下の画像に示すように設定を保存します:
ユーザー名とメールに送信された一時的パスワードを使用してサインインしてください。初回サインイン時には、パスワードのリセットを求められます。パスワードをリセットした後、質問し始めることができます。例えば、「2026 年 1 月の AWS コストはいくらですか?」と尋ねてください。コストについて質問すると、システムは get_cost_and_usage ツールを使用してデータを取得し、サービス別の詳細な内訳を提供します。
「現在の費用削減の機会は何ですか?」と尋ねてください。エージェントは複数のツールを呼び出して最適化の機会を特定します:
- get_rightsizing_recommendations – 過剰プロビジョニングまたは未利用のリソースを特定する
- get_savings_plans_recommendations – コミットメントベースの割引プランを提案する
- get_compute_optimizer_recommendations – コンピューティングの最適化に関する洞察を提供する
次に、「未利用の EC2 インスタンスの詳細を教えてください」と尋ねてください。会話の記憶機能により、フォローアップ質問は前の質問からの文脈を維持し、特定のインスタンスについて詳細な情報を提供します。
以下の動画で、この対話セッションの実行を確認できます。
試すための追加のサンプルクエリを以下に示します:
- 「過去 30 日間のリージョン別のコストを表示してください」
- 「今後 3 ヶ月間のコスト予測はどうなりますか?」
- 「t3.micro と t3.small インスタンスの価格を比較してください」
- 「アカウントにコスト異常はありますか?」
- 「無料枠の使用状況はどうなっていますか?」
- 「予算とその現在のステータスを表示してください」
- 「us-east-1 における Lambda の料金を教えてください」
- 「EC2 インスタンスの適正サイズ化(rightsizing)の推奨事項を取得してください」
コンバーサショナルメモリの実践
AgentCore Memory は、複数の質問にわたって文脈を維持します:
あなた:「コスト別で上位 5 つのサービスは何ですか?」 エージェント:(上位 5 つのサービスのリストを提供)
あなた:「2 番目はどうですか?」 エージェント:(前のリストを記憶し、詳細を提供)
あなた:「それを最適化するにはどうすればよいですか?」 エージェント:(最適化の推奨事項を提供)
以下の動画で、この対話セッションの実践をご覧ください。
AgentCore Memory は会話履歴を自動的に管理し、Strands セッションマネージャーが各リクエストに対して関連する文脈を取得します。
クリーンアップ
将来の課金を避けるために、本ソリューションによって作成されたリソースを削除してください。
スタックを削除:
原文を表示
Managing costs across multiple AWS accounts often requires finance teams to query data from several sources to get a complete view of spending and optimization opportunities. In this post, you learn how to build a FinOps agent using Amazon Bedrock AgentCore that helps your finance team manage AWS costs across multiple accounts. This conversational agent consolidates data from AWS Cost Explorer, AWS Budgets, and AWS Compute Optimizer into a single interface, so your team can ask questions like “What are my top cost drivers this month?” and receive immediate answers.
You learn to set up the architecture, deploy the solution using AWS Cloud Development Kit (AWS CDK), and interact with your cost data through natural language queries. The solution uses AgentCore, Anthropic Claude Sonnet 4.5, the Strands Agent SDK, and the Model Context Protocol (MCP).
You will have conversation memory that retains 30 days of context, so you can ask follow-up questions without repeating information. Over 20 specialized tools cover the full spectrum of cost management, from analysis to optimization, alleviating the need to manually navigate multiple AWS consoles. Natural language interaction makes cost data accessible to team members across your organization.
Solution overview
This solution consists of two main components: the authentication and frontend layer and the Amazon Bedrock AgentCore Runtime with tools and memory. Amazon Cognito manages user authentication while the AgentCore Runtime processes cost management queries. The authentication and frontend layer uses AWS Amplify to host the web application interface and Amazon Cognito for user authentication. Amazon Cognito handles user authentication and provides temporary AWS credentials through Identity Pools.
The custom agent for FinOps is hosted on AgentCore Runtime and built with the Strands Agent that integrates with Amazon Bedrock to access a Large Language Model (LLM). Amazon Bedrock AgentCore Gateway manages tool invocations and routes requests to backend services using AWS Identity and Access Management (IAM) authentication. MCP Servers are hosted on AgentCore Runtime to provide access to AWS Billing and Cost Management tools. AgentCore Memory maintains conversation history for up to 30 days of context retention. AgentCore Identity manages the OAuth 2.0 credential lifecycle for secure communication between the Gateway and MCP server runtimes. It stores the Amazon Cognito M2M client credentials as an OAuth credential provider and issues tokens on behalf of the Gateway when it needs to authenticate with the MCP runtimes.
With these components in place, the following section examines how they work together in the complete architecture.
Architecture diagram
The following diagram represents the solution architecture, which contains five key sections:
Section A – Authentication Infrastructure: First, the FinOpsAuthStack CDK stack deploys the authentication infrastructure (Amazon Cognito User Pool, Identity Pool, M2M client, resource server, and IAM roles). The User Pool handles user authentication, the M2M client enables machine-to-machine OAuth 2.0 flows between the Gateway and MCP runtimes, and the Identity Pool provides temporary AWS credentials that allow the frontend application to securely communicate with the AgentCore Runtime.
Section B – Image Build Infrastructure: Next, the FinOpsImageStack CDK stack deploys the container image build pipeline (Amazon S3 bucket, AWS CodeBuild projects, and Amazon Elastic Container Registry (Amazon ECR) repositories). CodeBuild clones the upstream AWS Labs MCP servers, applies a stdio-to-HTTP transformation (patching them for streamable-http transport), and builds AWS Graviton (ARM64) container images that are stored in Amazon ECR for use by the AgentCore Runtimes.
Section C – MCP Server Runtimes: The FinOpsMCPRuntimeStack CDK stack deploys two AgentCore Runtimes running the transformed AWS Labs MCP servers (Billing and Pricing). Each runtime is configured with JWT authorization using the AuthStack’s Amazon Cognito and has specific IAM permissions for the AWS APIs it accesses. For example, AWS Billing and Cost Management and AWS Compute Optimizer for the Billing runtime, and AWS Pricing for the Pricing runtime.
Section D – AgentCore Gateway: The FinOpsAgentCoreGatewayStack CDK stack deploys the AgentCore Gateway with AWS_IAM authorization, an OAuth credential provider (registered with AgentCore Identity using the AuthStack’s Cognito M2M credentials), and two MCP server targets pointing to the Billing and Pricing runtimes. The Gateway provides a unified tool discovery and invocation endpoint, handling OAuth token exchange for outbound authentication to the MCP runtimes.
Section E – Main Agent Runtime: Finally, the FinOpsAgentRuntimeStack CDK stack deploys the main AgentCore Runtime. It uses the Strands Agent Framework with Claude Sonnet 3.7 to orchestrate model invocations and tool calls through the Gateway. It also deploys AgentCore Memory for conversation history. The Runtime connects to the Gateway via IAM SigV4 authentication, discovers 24 tools from both MCP servers, and routes tool requests through the Gateway to retrieve cost, billing, and pricing data.
Using the web application
Now that you understand the architecture, let’s walk through a sample request flow. For example, what happens when a user asks “What are my AWS costs for January 2026?”
- The FinOps user accesses the web application hosted on AWS Amplify, which serves the frontend (HTML, CSS, JavaScript).
- The user authenticates with Amazon Cognito. Amazon Cognito validates the credentials and returns temporary AWS credentials from the Identity Pool.
- The frontend sends the user’s question to the AgentCore Runtime and uses the temporary AWS credentials to call InvokeAgentRuntime.
- The Strands agent inside the runtime sends the question along with 24 available tool definitions to Claude Sonnet 4.5 on Amazon Bedrock. The model analyzes the question and decides it needs to call the billingMcp__cost_explorer
- The agent receives the tool call request from the model and routes it to the AgentCore Gateway using IAM SigV4 authentication (InvokeGateway).
- The Gateway must authenticate with the MCP runtime. It contacts AgentCore Identity to obtain an OAuth 2.0 token using the registered credential provider (backed by Cognito M2M client credentials).
- The Gateway sends the MCP tools/call request with the OAuth token to the Billing MCP Runtime.
- The Billing MCP Runtime executes the actual API call to AWS Cost Explorer and requests cost and usage data for January 2026 using its execution role.
- The cost data flows back through the chain. Billing MCP Runtime responds to the Gateway, then the Gateway responds to the agent. The agent sends the cost data back to Amazon Bedrock, where Claude generates a natural language summary of the January 2026 costs.
- The formatted response is returned to the FinOps user, displaying the cost breakdown in the chat interface.
Prerequisites
Before you begin, verify that you have:
- An AWS account with appropriate permissions for the following services:
Amazon Bedrock, AgentCore, Amazon ECR, AWS Lambda, Amazon Cognito, AWS CodeBuild, and IAM
- AWS Command Line Interface (AWS CLI) (v2.x) configured with credentials
- Node.js (v18 or later) and npm installed
- Python 3.13 or higher installed
- AWS CDK installed and bootstrapped in your AWS account
Install: npm install -g aws-cdk
- Bootstrap: cdk bootstrap aws://AWS-ACCOUNT-NUMBER/AWS-REGION
Deploy the solution using AWS CDK
This solution deploys to the us-east-1 AWS Region. The deployment uses the AWS CDK to provision the infrastructure through three AWS CloudFormation stacks.
To deploy the solution:
Step 1: Clone the repository
git clone https://github.com/aws-samples/sample-finops-agent-amazon-bedrock-agentcore
cd sample-finops-agent-amazon-bedrock-agentcoreStep 2: Set environment variables
Replace your-email@example.com with your email address to receive the temporary admin password:
export ADMIN_EMAIL="your-email@example.com"Step 3: Deploy using CDK
cd cdk && npm install && npm run build && npx cdk bootstrap && npx cdk deploy --all --require-approval neverThe deployment script installs CDK dependencies, builds TypeScript code, bootstraps the CDK if needed, then deploys the three stacks in sequence. The process takes approximately 15-20 minutes. After completion, you will have five CloudFormation Stacks within your account.
After deployment completes of the last CloudFormation Stack FinOpsAgentRuntimeStack, note the following outputs from the terminal:
- User Pool Id – Cognito Identity Pool ID
- User Pool Client Id – Cognito User Pool Client ID
- Identity Pool Id – Identity Pool ID
- AgentCore ARN – AgentCore runtime ARN
The following screenshot shows you what the Outputs will look like.
You will receive an email with a temporary password for the admin user.
With the infrastructure deployed, you can now configure and use the web application to interact with your cost data.
Deploy the Amplify application
While we provide a sample frontend hosted on AWS Amplify, you can integrate the solution with your own custom frontend or connect it to your existing enterprise communication tools. The frontend application requires manual deployment using code from the GitHub repository:
- Download the frontend code AWS-Amplify-Frontend.zip from GitHub.
- Navigate to AWS Amplify in the AWS Management Console.
- Choose Deploy without Git provider.
- Upload the application .zip file.
- Wait for deployment to complete.
- Note the generated domain URL.
Understanding the MCP servers
MCP servers (AWS Billing and Cost Management MCP Server and AWS Pricing MCP Server) provide cost management and pricing tools. Each MCP server is designed to handle specific types of queries. The AWS Billing and Cost Management MCP Server focuses on historical spend analysis, budget monitoring, cost anomaly detection, and optimization recommendations using your actual AWS account data. The AWS Pricing MCP Server handles forward-looking queries by providing real-time pricing data from the AWS Price List API, enabling cost estimation for new workloads and infrastructure as code (IaC) projects.
Using the web application
Open the URL provided after creating your AWS Amplify application. You will be prompted to enter your Amazon Cognito and AgentCore configuration details. Input the values from your stack output (collected earlier). From the Agent Type menu, select AgentCore Agent, enter the deployment Region, and choose an Agent Name (in this example, we use AgentCore Agent). Save the configuration as shown in the following image:
Sign in with your username and the temporary password sent to your email. At first sign-in, you will be asked to reset your password. After resetting your password, you can start asking questions. For example, ask “What are my AWS costs for January 2026?” When you ask about costs, the system retrieves data using the get_cost_and_usage tool to retrieve your cost data and provides a detailed breakdown by service.
Ask “What are my current cost savings opportunities?” The agent calls multiple tools to identify optimization opportunities:
- get_rightsizing_recommendations – identifies over-provisioned or underutilized resources
- get_savings_plans_recommendations – suggests commitment-based discount plans
- get_compute_optimizer_recommendations – provides compute optimization insights
Next, ask “Can you give me details of any underutilized EC2 instances?” Because of conversation memory, follow-up questions maintain context from the previous question and provide detailed information about specific instances.
See this interactive session in action in the following video.
Here are additional sample queries to try:
- “Show me my costs by Region for the last 30 days”
- “What’s my cost forecast for the next 3 months?”
- “Compare pricing for t3.micro and t3.small instances”
- “Are there any cost anomalies in my account?”
- “What’s my free tier usage status?”
- “Show me my budgets and their current status”
- “What’s the pricing for Lambda in us-east-1?”
- “Get rightsizing recommendations for my EC2 instances”
Conversational memory in action
AgentCore Memory maintains context across multiple questions:
You: “What are my top 5 services by cost?” Agent: (Provides list of top 5 services)
You: “What about the second one?” Agent: (Remembers the previous list and provides details)
You: “How can I optimize it?” Agent: (Provides optimization recommendations)
See this interactive session in action in the following video.
AgentCore Memory automatically manages conversation history, and the Strands session manager retrieves relevant context for each request.
Clean up
To avoid incurring future charges, delete the resources created by this solution.
Delete the stacks:
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み