COLUMN
Amazon Q Developerを利用してAWS利用費をどこまで最適化できるのか試してみた
本コラムでは、Amazon Q Developerの基本機能を解説し、コスト分析機能の実践検証を通じて、効果的な活用法と運用上の注意点を明らかにします。
1. Amazon Q Developer の基本機能と利用方法
Amazon Q Developerは、AWS(Amazon Web Services)アプリケーションの開発、管理、運用を支援するために設計された生成AI(人工知能)を活用した会話型アシスタントです。このツールを利用することにより、開発者はAWSリソースやアーキテクチャに関する質問を行ったり、ベストプラクティスやドキュメントにアクセスしたりすることができます。
Amazon Q Developer を利用するインターフェースとして、大きく次の2つの方法から選択して利用することができます。
- Amazon Q Developer の利用権限を持ったIAMで、 AWS Management Console にログインして利用する
- Amazon Q 拡張機能をインストールして、IDE環境やコマンドラインから利用する
Amazon Q Developerは、AWS公式の生成AIサービスとして利用中のAWS環境に直接アクセスできる特徴があります。そこで、AWS利用における重要な課題の一つであるコスト分析機能を実際に検証するため、評価用のAWS環境を使用して試してみることにしました。
2. AWS Management ConsoleからAmazon Q Developerを使ってコスト分析してみた
IT管理者の観点では、新たな分析環境を構築することなく、普段使用しているAWS Management Consoleから直接コスト分析が行えることが最も効率的です。利用開始方法は非常にシンプルで、AWS Management Consoleの画面右上にあるAmazon Q Developer アイコンをクリックするだけです。
ただし、残念ながら2025年6月現在では日本語での利用はできないようです。早く対応してくれることを期待しましょう。
気を取り直して、英語で質問してみます。
Please investigate the AWS usage costs for the past few months and list the problems (過去数ヶ月のAWS利用コストを調査して、問題点をリストアップしてください)
Based on my analysis of your AWS usage costs for the past few months, I've identified several cost anomalies and potential problems:
EC2 - Other: Showing a consistent upward trend with costs increasing from $168.08 in March to $216.53 in May 2025. This represents a monthly increase of about $25.
Amazon QuickSight: Significant growth from $0 in March to $31.58 in May 2025, with a notable jump of $13.45 between April and May.
Amazon Elastic Compute Cloud - Compute: Sharp increase from $2.04 in March to $20.31 in May 2025, with costs nearly doubling each month.
Amazon Elastic Load Balancing: Costs increased by $9.71 between April and May 2025, reaching $27.73.
AWS Config: Costs increased by $5.22 between April and May 2025, reaching $14.23.
Tax: Increased from $38.90 in March to $48.81 in May 2025, with a notable jump of $8.71 in the last month.
Amazon Virtual Private Cloud: Shows volatility, decreasing from $56.86 in March to $25.98 in April, then increasing to $34.00 in May 2025.
AmazonCloudWatch: Slight increase from March to May 2025, with costs at $32.50 in May.
AWS Security Hub: Relatively stable but showing a small increase in May 2025 to $56.23.
AWS Key Management Service: Stable costs around $12.13 per month.
The most concerning trends appear to be in EC2-related services, QuickSight, and Elastic Load Balancing, which show consistent or sudden increases. Would you like me to help investigate any specific service cost in more detail or provide recommendations for cost optimization?
利用言語は英語ですが、簡潔な質問に対してここまで詳細で丁寧な回答が得られるのは非常に有用です。これにより、コストの大部分を占めるリソースの特定や、直近の利用トレンドの変化といった情報を簡単に調べることができることがわかりました。続けてもう少しコスト削減できるところが無いかも質問してみます。
Tell me how to reduce costs (コストを削減する方法を教えてください)
Based on your AWS usage patterns and the cost analysis, here are specific recommendations to help you reduce your AWS costs:
Immediate Cost Savings Opportunities:
Delete Unused EBS Volumes: I've identified several unused EBS volumes that could save you approximately $94.73 monthly:
vol-0148exxxxxxxxe042d ($26.40/month savings)
vol-0a6e2xxxxxxxxd954c ($5.76/month savings)
vol-0a734xxxxxxxxeacda ($3.60/month savings)
vol-0bf4exxxxxxxx2a3e7 ($3.60/month savings)
vol-0471dxxxxxxxx030e1 ($3.60/month savings)
Plus 27 additional EBS volume recommendations
Lambda Optimization: There's also a recommendation for a Lambda function that could save $0.27/month.
Service-Specific Cost Reduction Strategies:
EC2 Cost Optimization:
Right-size your EC2 instances using AWS Compute Optimizer
Implement auto-scaling to reduce capacity during low-demand periods
Consider Reserved Instances or Savings Plans for predictable workloads
Use Spot Instances for non-critical, fault-tolerant workloads
Review and terminate idle instances
QuickSight Cost Reduction:
Audit user access and remove unnecessary users
Consider switching from Enterprise to Standard edition if advanced features aren't needed
Optimize SPICE capacity usage
Elastic Load Balancing (ELB):
Delete unused load balancers
Consider using Application Load Balancers instead of multiple Classic Load Balancers
Optimize the number of load balancer rules
CloudWatch Optimization:
Review and adjust metric collection frequency
Delete unused dashboards, alarms, and logs
Set appropriate log retention periods
Use metric filters selectively
VPC Cost Reduction:
Review and optimize NAT Gateway usage (consider NAT Instances for lower workloads)
Use VPC Endpoints for AWS services to reduce data transfer costs
Delete unused VPC components (endpoints, gateways)
General Cost Management Practices:
Implement Cost Controls:
Set up AWS Budgets with alerts
Use AWS Cost Explorer to analyze spending patterns
Enable AWS Cost Anomaly Detection
Regular Cleanup:
Schedule regular reviews to identify and remove unused resources
Implement tagging strategies to track resource ownership and purpose
Storage Optimization:
Migrate from gp2 to gp3 EBS volumes
Implement S3 lifecycle policies for infrequently accessed data
Use AWS Trusted Advisor:
Regularly check cost optimization recommendations
Would you like me to provide more detailed guidance on implementing any of these specific recommendations?
Sources
How to reduce VPC and Elastic load balancing costs? | AWS re:Post
COST01-BP05 Report and notify on cost optimization - AWS Well-Architected Framework
How Infor saved $2 millions with effective CFM strategies | AWS Cloud Financial Management
COST02-BP05 Implement cost controls - AWS Well-Architected Framework
関連ドキュメントへの言及とともに、未使用のEBSボリュームの具体的なリストも提示してくれました。ただし、一般的な回答が中心で、実際の環境固有の情報が限定的だったため、より具体的な対処方法について追加で質問してみました。
What should I delete or fix specifically? (具体的に何を削除または修正すべきですか?)
Based on my analysis, here are the specific resources you should delete or fix to reduce your AWS costs:
Immediate Actions (Highest Savings):
Delete Unused EBS Volumes in ap-northeast-1 region:
vol-0148exxxxxxxe042d ($26.40/month savings)
vol-0a6e2xxxxxxxd954c ($5.76/month savings)
vol-0a734xxxxxxxeacda ($3.60/month savings)
vol-0bf4exxxxxxx2a3e7 ($3.60/month savings)
vol-0471dxxxxxxx030e1 ($3.60/month savings)
Before deleting, create snapshots of these volumes if you need to preserve any data.
Terminate or Rightsize 17 Stopped EC2 Instances in ap-northeast-1:
"test-hoge-win2016" (t2.micro)
"hoge-windows2022serv_test_nsclient" (t2.large)
"hoge-ad" (t3.large)
Several Netskope Private Access Publisher instances (t3.medium)
Other stopped instances that are incurring storage costs
These stopped instances are still generating EBS volume costs even when not running.
Review Load Balancers:
"hoge-alb" (internal ALB)
"test-web-alb" (internet-facing ALB)
Verify if these are receiving traffic and delete if unused or used only for testing.
Additional Cost Optimization Actions:
QuickSight Optimization:
Review your QuickSight subscription model
Check for unused SPICE capacity
Review user licenses and remove any for users who no longer need access
EC2 Instance Scheduling:
Implement Amazon EC2 Instance Scheduler for non-production instances
Set up automated shutdown during non-business hours for development/test instances
CloudWatch and Monitoring:
Review CloudWatch metrics and alarms, removing any that are unnecessary
Optimize log retention periods
Elastic IP Addresses:
Check for unattached Elastic IPs, which incur charges when not associated with running instances
Implementation Steps:
For EBS volumes:
Go to EC2 console > Volumes
Select each volume ID
Create snapshots if needed
Detach from instances
Delete the volumes
For stopped EC2 instances:
Go to EC2 console > Instances
Filter by "Stopped" state
Review each instance and terminate those no longer needed
For load balancers:
Go to EC2 console > Load Balancers
Check CloudWatch metrics for request counts
Delete any load balancers with minimal or no traffic
Would you like me to provide more detailed instructions for implementing any of these specific recommendations?
英語での受け答えについても、生成AIを活用しやすくなった昨今では言語の障壁はそこまで大きな負担とはならないと思います。自然言語での質問に対して詳細な回答が得られるので、コスト分析の手始めとして十分活用できるのではないかと思います。
3. Amazon Q Developer for CLIを使ってコスト分析してみた
Amazon Q Developerのインターフェースとしては、AWS Management Console 以外にも各種IDE環境から利用する方法がありますが、今回はその中でもAmazon Q Developer for CLIからの利用を試してみます。
手っ取り早く AWS Management Console から起動できるCLI環境である AWS CloudShell から Amazon Q Developer for CLI をできれば手軽に利用しやすいのではないかと考えましたが、2025年6月現在では AWS CloudShell から Amazon Q Developer for CLI の利用はできない状態でした。
> AWS CloudShell has temporarily disabled Amazon Q chat functionality due to an internal issue. We're actively investigating and will restore this functionality as soon as possible. In the meantime, you can continue using Q chat in the AWS Management Console.
https://github.com/aws/amazon-q-developer-cli/issues/1944
ということで、Windows端末上のWSLから Amazon Q Developer for CLI を利用できるようにしてみようと思います。初期設定の方法は、下記コラムに詳しく書かれているのでそちらを参考にしていただくと良いと思います。少し初期設定には時間がかかりますが、"q doctor" コマンド結果でエラーが無くなるまでセットアップできれば、 Amazon Q Developer for CLI から日本語で利用しているAWS環境に対する質問ができるようになります。
参考:Amazon Q Developer for CLIを使って、AWSのリソースをAIで作成⇒調査⇒構成図作成までやってみて、構築作業を楽にしよう
日本語で質問をしてみます。概ね英語で質問した結果と内容は差異が無いのですが、英語よりもやはり質問しやすいですし、圧倒的に読み易いですね。
> AWS利用費を見て改善すべきポイントを具体的に教えて!
AWS利用費の改善ポイントを具体的に分析するために、まず現在のAWS利用状況を確認させてください。
🛠️ Using tool: use_aws (trusted)
⋮
● Running aws cli command:
Service name: ce
Operation name: get-cost-and-usage
Parameters:
- GroupBy: [{"Key":"SERVICE","Type":"DIMENSION"}]
- Metrics: ["BlendedCost"]
- TimePeriod: {"End":"2025-06-24","Start":"2025-05-25"}
- Granularity: "DAILY"
Profile name: default
Region: us-east-1
Label: 過去30日間のコスト分析
⋮
● Completed in 3.64s
次に、月別の総コストを確認してみましょう。
🛠️ Using tool: use_aws (trusted)
⋮
● Running aws cli command:
Service name: ce
Operation name: get-cost-and-usage
Parameters:
- TimePeriod: {"End":"2025-06-24","Start":"2025-01-01"}
- Granularity: "MONTHLY"
- Metrics: ["BlendedCost"]
Profile name: default
Region: us-east-1
Label: 月別総コスト分析
⋮
● Completed in 2.69s
現在のコスト状況を分析した結果、以下の具体的な改善ポイントをお伝えします:
## 🔍 現在のコスト状況
• **月額平均**: 約$470-560(5月は$562.74と最高額)
• **6月現在**: $423.73(23日間で既に高額)
## 💰 主要コスト要因と改善ポイント
### 1. EC2関連(最大のコスト要因)
• **EC2 - Other**: 1日約$7-11(月額$200-300)
• **改善策**:
• インスタンスサイズの見直し(オーバースペックの可能性)
• 使用率の低いインスタンスの停止・削除
• Reserved Instancesの検討(最大75%削減)
• Spot Instancesの活用
### 2. AWS Systems Manager(急増中)
• **6月1日**: $7.05と異常に高額
• **改善策**:
• Session Managerの使用量確認
• 不要なパッチ管理の停止
• Parameter Storeの使用量最適化
### 3. Amazon Cognito(新規追加)
• **6月1日**: $3.76
• **改善策**:
• ユーザープール使用量の監視
• 不要な認証フローの削除
### 4. AWS Security Hub
• **日額**: 約$1.8-2.0
• **改善策**:
• 必要なセキュリティ標準のみ有効化
• 不要なリージョンでの無効化
### 5. Amazon QuickSight
• **固定費**: $1.6/日(月額約$48)
• **改善策**:
• 使用頻度の確認
• 不要な場合は削除検討
### 6. VPC・ネットワーク関連
• **VPC**: $1.5/日、**ELB**: $1.17/日
• **改善策**:
• 不要なNAT Gatewayの削除
• Load Balancerの統合
## 🎯 即効性のある改善アクション
### 優先度1(即実行)
1. 未使用リソースの削除
• 停止中のEC2インスタンス
• 未使用のEBSボリューム
• 古いスナップショット
2. Systems Managerの使用量確認
• 異常な課金の原因調査
### 優先度2(1週間以内)
1. EC2インスタンスの最適化
• CloudWatch メトリクスでCPU使用率確認
• 適切なインスタンスタイプへの変更
2. Reserved Instancesの検討
• 継続利用するインスタンス向け
### 優先度3(1ヶ月以内)
1. セキュリティサービスの見直し
• Security Hub、GuardDuty、Inspectorの必要性確認
2. ストレージの最適化
• S3のストレージクラス見直し
• 不要なデータの削除
## 📊 期待される削減効果
• **短期(1ヶ月)**: 20-30%削減($100-150/月)
• **中期(3ヶ月)**: 40-50%削減($200-250/月)
具体的にどのリソースから確認したいか教えてください。詳細な分析とアクションプランを提供します!
ここでさらに、Amazon Q Developer for CLI に Cost Explorer MCP Server をつないでみて挙動が変わるのかについても確認してみました。
https://awslabs.github.io/mcp/servers/cost-explorer-mcp-server/
Cost Explorer MCP Server 利用なしの場合とあえて同じ質問文で聞いてみました。結果が都度若干異なるのは生成AIの気分次第で誤差の範囲という印象ですが、既にAmazon Q DeveloperにCost Explorer 情報を参照する機能が付随されている為か、2025年6月時点では機能差分は確認できませんでした。
> AWS利用費を見て改善すべきポイントを具体的に教えて!
AWS利用費の分析と改善提案を行うために、まず現在の利用状況を確認させていただきます。
🛠️ Using tool: get_today_date from mcp server awslabscost_explorer_mcp_server
⋮
● Running get_today_date with the param:
⋮ {
⋮ "arguments": {},
⋮ "name": "get_today_date"
⋮ }
Allow this action? Use 't' to trust (always allow) this tool for the session. [y/n/t]:
> y
⋮
● Completed in 0.5s
直近3ヶ月間のAWS利用費をサービス別に分析してみましょう。
🛠️ Using tool: get_cost_and_usage from mcp server awslabscost_explorer_mcp_server
⋮
● Running get_cost_and_usage with the param:
⋮ {
⋮ "arguments": {
⋮ "date_range": {
⋮ "end_date": "2025-06-23",
⋮ "start_date": "2025-04-01"
⋮ },
⋮ "granularity": "MONTHLY",
⋮ "group_by": "SERVICE",
⋮ "metric": "UnblendedCost"
⋮ },
⋮ "name": "get_cost_and_usage"
⋮ }
Allow this action? Use 't' to trust (always allow) this tool for the session. [y/n/t]:
> y
⋮
● Completed in 1.125s
次に、最も費用の高いEC2リソースの詳細を確認してみましょう。
🛠️ Using tool: get_cost_and_usage from mcp server awslabscost_explorer_mcp_server
⋮
● Running get_cost_and_usage with the param:
⋮ {
⋮ "arguments": {
⋮ "date_range": {
⋮ "end_date": "2025-06-23",
⋮ "start_date": "2025-04-01"
⋮ },
⋮ "filter_expression": {
⋮ "Dimensions": {
⋮ "Key": "SERVICE",
⋮ "MatchOptions": [
⋮ "EQUALS"
⋮ ],
⋮ "Values": [
⋮ "EC2 - Other"
⋮ ]
⋮ }
⋮ },
⋮ "granularity": "MONTHLY",
⋮ "group_by": "USAGE_TYPE",
⋮ "metric": "UnblendedCost"
⋮ },
⋮ "name": "get_cost_and_usage"
⋮ }
Allow this action? Use 't' to trust (always allow) this tool for the session. [y/n/t]:
> y
⋮
● Completed in 0.808s
## AWS利用費分析結果と改善提案
3ヶ月間(2025年4月〜6月)の利用費分析から、以下の改善ポイントを特定しました:
### 📊 現在の利用状況
• **総費用**: $1,471.43(3ヶ月間)
• **月平均**: 約$490
• **最高額月**: 2025年5月($572.99)
### 🎯 主要な改善ポイント
#### 1. EBSストレージの最適化(最優先)
現状: EC2-Other(主にEBS)が全体の38.4%($564.77)を占める
• **gp2ボリューム**: $196.90(3ヶ月)
• **gp3ボリューム**: $124.71(3ヶ月)
• **スナップショット**: $103.34(3ヶ月)
改善策:
• gp2からgp3への移行で20-50%のコスト削減
• 不要なスナップショットの削除(自動化推奨)
• EBSボリュームサイズの見直し
期待効果: 月$50-100の削減
#### 2. AWS Security Hubの見直し
現状: $151.70(3ヶ月)で2番目に高額
改善策:
• 必要なセキュリティ標準のみ有効化
• 使用していない地域での無効化
• AWS Config Rulesとの重複確認
期待効果: 月$20-30の削減
#### 3. VPCとネットワーク費用の最適化
現状: VPC関連で$95.35、ELBで$73.74(3ヶ月)
改善策:
• NAT Gatewayの使用量確認($90.09)
• 不要なロードバランサーの削除
• データ転送量の最適化
期待効果: 月$15-25の削減
#### 4. QuickSightライセンスの見直し
現状: $85.58(3ヶ月)
改善策:
• 未使用ユーザーの削除
• 必要に応じてReaderライセンスへの変更
期待効果: 月$10-20の削減
#### 5. CloudWatchの最適化
現状: $79.39(3ヶ月)
改善策:
• 不要なメトリクスとログの削除
• ログ保持期間の見直し
• カスタムメトリクスの精査
期待効果: 月$10-15の削減
### 💡 即座に実行できるアクション
1. EBSスナップショットの棚卸し
bash
aws ec2 describe-snapshots --owner-ids self --query 'Snapshots[?StartTime<=2024-12-01]'
2. 未使用EBSボリュームの確認
bash
aws ec2 describe-volumes --filters Name=status,Values=available
3. Security Hub有効地域の確認
bash
aws securityhub get-enabled-standards
### 📈 期待される総削減効果
• **月間削減見込み**: $105-190
• **年間削減見込み**: $1,260-2,280
• **削減率**: 約20-40%
これらの改善により、月額利用料を$300-400程度まで削減できる可能性があります。まずはEBSの最適化から始めることをお勧めします!
今回は試しませんが、ユースケースとしては Amazon Q Developer for CLI ではない他のMCP対応AIエージェント環境からAWS利用費の分析をしたい場合には、この Cost Explorer MCP Server が活用できそうです。
4. まとめ
今回 Amazon Q Developer の機能の1つである「コスト分析」に着目して、複数のアプローチでその機能を検証してみました。MCPサーバーを使った拡張要件などがある場合や、IDEを使った開発環境においては独自環境に Amazon Q Developer for CLI が利用できるようセットアップしていくと良いでしょう。一方で、標準的なコスト分析であれば AWS Management Console から利用できる Amazon Q Developer で十分であり、より日本語対応が進んで行けば、AWS初心者でもさらに簡単にAWSを活用できるようになると思いますので、ぜひ活用を検討いただければと思います。
無料ダウンロード
自社のクラウド導入に必要な知識、ポイントを
この1冊に総まとめ!
あなたはクラウド化の
何の情報を知りたいですか?
- そもそも自社は本当にクラウド化すべき?オンプレとクラウドの違いは?
- 【AWS・Azure・Google Cloud】
どれが自社に最もマッチするの? - 情シス担当者の負荷を減らしてコストを軽減するクラウド化のポイントは?
- 自社のクラウド導入を実現するまでの具体的な流れ・検討する順番は?
初めての自社クラウド導入、
わからないことが多く困ってしまいますよね。
NTT東日本では
そんなあなたにクラウド導入に必要な情報を
1冊の冊子にまとめました!
クラウド化のポイントを知らずに導入を進めると、以下のような事になってしまうことも・・・
- システムインフラの維持にかかるトータルコストがあまり変わらない。。
- 情シス担当者の負担が減らない。。
- セキュリティ性・速度など、クラウド期待する効果を十分に享受できない。。
理想的なクラウド環境を実現するためにも、
最低限の4つのポイントを
抑えておきたいところです。
-
そもそも”クラウド化”とは?
その本質的なメリット・デメリット - 自社にとって
最適なクラウド環境構築のポイント - コストを抑えるための
具体的なコツ - 既存環境からスムーズにクラウド化を
実現するためのロードマップ
など、この1冊だけで自社のクラウド化のポイントが簡単に理解できます。
またNTT東日本でクラウド化を実現し
問題を解決した事例や、
導入サポートサービスも掲載しているので、
ぜひダウンロードして読んでみてください。
面倒でお困りのあなたへ
クラウドのご相談できます!
無料オンライン相談窓口
NTT東日本なら貴社のクラウド導入設計から
ネットワーク環境構築・セキュリティ・運用まで
”ワンストップ支援”が可能です!
NTT東日本が選ばれる5つの理由
- クラウド導入を
0からワンストップでサポート可能! - 全体最適におけるコスト効率・業務効率の改善を
中立的にご提案 - クラウド環境に問題がないか、
第3者目線でチェック
してもらいたい - 安心の24時間・365日の対応・保守
- NTT東日本が保有する豊富なサービスの組み合わせで
”課題解決”と”コスト軽減”を両立
特に以下に当てはまる方はお気軽に
ご相談ください。
- さまざまな種類やクラウド提供事業者があってどれが自社に適切かわからない
- オンプレミスのままがよいのか、クラウド移行すべきなのか、迷っている
- オンプレミスとクラウド移行した際のコスト比較を行いたい
- AWSとAzure、どちらのクラウドが自社に適切かわからない
- クラウド環境に問題がないか、第3者目線でチェックしてもらいたい
- クラウド利用中、ネットワークの速度が遅くて業務に支障がでている
クラウドを熟知するプロが、クラウド導入におけるお客さまのLAN 環境や接続ネットワーク、
クラウドサービスまでトータルにお客さまのお悩みや課題の解決をサポートします。
相談無料!プロが中立的にアドバイスいたします
クラウド・AWS・Azureでお困りの方はお気軽にご相談ください。