0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[AWS]GuardDutyはプライベート環境でも有効化しよう

Last updated at Posted at 2025-09-21

はじめに

この記事の結論

  • GuardDutyはプライベート環境でもセキュリティ対策には必要!!
  • Fargateを使う場合は、GuardDutyを有効化しただけではFargateの異常検知は無効のまま。Runtime Monitoring機能を有効にする必要がある。

この記事を書いたきっかけ

自分の勉強不足で今までCDKにおいてFargateのGuardDutyを有効化するためには明示的にRuntime Monitoring機能の有効化指定が必要だと知りませんでした。またそれに合わせてGuardDutyのVPCエンドポイントについても必要なことを知りました。

再確認した内容

そんなこともあり、今更ながらGuardDutyとVPCエンドポイントについて調べなおしてみました。いい時代になったもので本記事のほとんどはQ Developer CLI+MCPサーバ(aws-knowledge-mcp-server)で調べた内容の再編集になります。調査結果はAWSドキュメント、CDKドキュメントでの再チェックもしてもらっています。ただし数が多いこともあり私自身での再チェックはできていません。誤りがあればコメントして頂けると幸いです。

追加情報

2025年9月21日時点の東京リージョンVPCエンドポイントサービス一覧をAWS CLIコマンドで作成して整形しました。

FargateのGuardDuty有効化

GuardDutyがプライベート環境でも必要な理由

🔍 検知対象の脅威

外部からの侵害以外にも多くの脅威を検知:
内部脅威: 権限昇格、異常なAPI呼び出しパターン
設定ミス: 意図しないパブリックアクセス、セキュリティグループの異常
マルウェア: EC2インスタンス内での悪意のあるプロセス
データ漏洩: 異常なデータ転送パターン
認証情報の不正使用: 盗まれたアクセスキーの使用

📊 データソース(インターネット接続不要)

VPC Flow Logs: ネットワークトラフィック分析
DNS Logs: 内部DNS クエリの異常検知
CloudTrail Event Logs: API呼び出しの異常パターン
EKS Audit Logs: Kubernetesクラスター内の異常
RDS Protection Logs: データベースへの異常アクセス

明示的設定が必要な理由

  1. Runtime Monitoringはデフォルト無効: 基本GuardDutyでは含まれない
  2. CloudFormation/CDK対応: API経由での設定が可能
  3. Infrastructure as Code: 設定の再現性とバージョン管理

設定しない場合の動作

• 基本GuardDuty機能のみ有効(CloudTrail Events、VPC Flow Logs、DNS Logs)
• Runtime Monitoring機能は無効のまま
• Fargateタスクにサイドカーコンテナは追加されない

🏢 プライベート環境での具体例

シナリオ: 完全プライベートなVPC環境
├── 検知可能な脅威
│ ├── 内部者による権限昇格
│ ├── 設定ミスによる意図しない公開
│ ├── 認証情報の内部流出・悪用
│ ├── マルウェアによる内部拡散
│ └── 異常なデータアクセスパターン

GuardDutyの有効化が必要なリソース

エージェントインストールが必要な機能

No. 機能 対象サービス エージェント要否 管理方法 検知内容
1 Runtime Monitoring EC2 ✅ 必要 手動/自動 ランタイム脅威、異常プロセス
2 Runtime Monitoring ECS (EC2起動) ✅ 必要 手動/自動 コンテナランタイム脅威
3 Runtime Monitoring EKS (EC2ノード) ✅ 必要 EKS Add-on/手動 Pod内異常実行
4 Runtime Monitoring Fargate (ECS) ❌ 不要 自動統合 コンテナランタイム脅威

GuardDutyの保護機能と有効化状況

No. 保護機能 デフォルト有効 30日無料 エージェント 検知内容
1 基本GuardDuty ✅ 自動 ✅ あり ❌ 不要 CloudTrail/VPC/DNS異常
2 EKS Protection ✅ 自動 ✅ あり ❌ 不要 Kubernetes API異常
3 S3 Protection ✅ 自動 ✅ あり ❌ 不要 バケット異常アクセス
4 RDS Protection ✅ 自動 ✅ あり ❌ 不要 DB異常ログイン
5 Lambda Protection ✅ 自動 ✅ あり ❌ 不要 関数内異常実行
6 Malware Protection (GuardDuty-initiated) ✅ 自動 ✅ あり ❌ 不要 EC2マルウェア自動スキャン
7 Runtime Monitoring ❌ 手動 ✅ あり ✅ 必要 ランタイム脅威監視
8 Malware Protection (On-demand) ❌ 手動 ❌ なし ❌ 不要 オンデマンドスキャン
9 Malware Protection for S3 ❌ 手動 ✅ 12ヶ月無料枠 ❌ 不要 S3マルウェアスキャン

注意事項

料金への影響

  • Runtime Monitoring: 約$2.00/エージェント/月
  • 30日間無料トライアル終了後に課金開始
  • VPCエンドポイント: $0.01/時間 + データ処理料金

必要な権限

  • GuardDuty管理権限
  • VPCエンドポイント作成権限
  • CloudFormation実行権限

Fargate自動管理付き設定

lib/guard-duty-stack.ts
import { GuardDuty } from 'aws-cdk-lib/aws-guardduty';
import { Stack, StackProps } from 'aws-cdk-lib';
import { Construct } from 'constructs';

export class GuardDutyStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    const detector = new GuardDuty.CfnDetector(this, 'GuardDutyDetector', {
      enable: true,
      features: [
        {
          name: 'RUNTIME_MONITORING',  // ✅ Runtime Monitoring機能を有効化
          status: 'ENABLED',           // ✅ 必須:明示的な有効化が必要
          additionalConfiguration: [
            {
              name: 'ECS_FARGATE_AGENT_MANAGEMENT',  // ✅ 
              status: 'ENABLED'  // ✅ Fargateタスクに自動でサイドカー追加
            }
          ]
        }
      ]
    });
  }
}

AWS VPCエンドポイントサービス完全ガイド - ap-northeast-1リージョン

取得日: 2025年9月21日
リージョン: ap-northeast-1(東京)

AWS VPCエンドポイントを使用することで、インターネットゲートウェイを経由せずにAWSサービスへプライベート接続が可能になります。以下上記取得日時点でap-northeast-1(東京)リージョンで利用可能な全316のVPCエンドポイントサービスを詳細に分類・整理しました。

概要

📊 サービス数サマリー(クリックで展開)
エンドポイント型 サービス数
Gateway型 3
Interface型 314
総計 317

カテゴリ別サマリー

カテゴリ サービス数
Gateway型エンドポイント 3
コンピューティング 11
ストレージ 7
データベース 14
AI・機械学習 23
ネットワーキング 10
セキュリティ・認証 24
監視・ログ 12
開発者ツール 12
分析・データ処理 20
コンテナ・レジストリ 2
メッセージング・通知 8
管理・ガバナンス 19
アプリケーション統合 6
IoT 12
メディア・ゲーム 4
位置情報 6
ビジネスアプリケーション 7
その他のサービス 87
特殊なエンドポイント 9
総計 316

AWS CLIでの取得方法

🔧 AWS CLIコマンド実行例(クリックで展開)

基本コマンド

全VPCエンドポイントサービス一覧を取得

aws ec2 describe-vpc-endpoint-services --region ap-northeast-1

サービス名のみを取得(推奨)

aws ec2 describe-vpc-endpoint-services --region ap-northeast-1 --query "ServiceNames" --output json

実行結果例

$ aws ec2 describe-vpc-endpoint-services --region ap-northeast-1 --query "ServiceNames" --output json
[
    "api.aws.ap-northeast-1.cassandra-streams",
    "aws.api.ap-northeast-1.emr-service-cell01",
    "com.amazonaws.ap-northeast-1.s3",
    "com.amazonaws.ap-northeast-1.dynamodb",
    "com.amazonaws.ap-northeast-1.ec2",
    "com.amazonaws.ap-northeast-1.lambda"
]

フィルタリング例

# S3関連サービスのみ
aws ec2 describe-vpc-endpoint-services --region ap-northeast-1 --query "ServiceNames[?contains(@, 's3')]" --output json

# Bedrock関連サービスのみ
aws ec2 describe-vpc-endpoint-services --region ap-northeast-1 --query "ServiceNames[?contains(@, 'bedrock')]" --output json

Gateway型エンドポイント

🚪 Gateway型エンドポイント(3サービス)
No. サービス名 説明
1 s3 Amazon Simple Storage Service (Amazon S3) - オブジェクトストレージ
2 dynamodb Amazon DynamoDB - NoSQLデータベースサービス
3 s3express S3 Express One Zone - 高速ストレージ

特徴: ルートテーブルにルートを追加することで利用。追加料金なし。

Interface型エンドポイント

コンピューティング

💻 コンピューティング(11サービス)
No. サービス名 説明
1 ec2 Amazon Elastic Compute Cloud (Amazon EC2) - 仮想サーバー
2 ec2messages Amazon EC2 Messages - EC2インスタンス用メッセージング
3 lambda AWS Lambda - サーバーレス関数実行
4 batch AWS Batch - バッチジョブ処理
5 ecs Amazon Elastic Container Service (Amazon ECS) - コンテナオーケストレーション
6 ecs-agent Amazon ECS Agent - ECSエージェント通信
7 ecs-telemetry Amazon ECS Telemetry - ECSテレメトリデータ
8 eks Amazon Elastic Kubernetes Service (Amazon EKS)
9 eks-auth Amazon EKS Auth - EKS認証サービス
10 eks-proxy Amazon EKS Proxy - EKSプロキシサービス
11 elastic-inference.runtime Amazon Elastic Inference Runtime - 機械学習推論アクセラレーション

ストレージ

💾 ストレージ(7サービス)
No. サービス名 説明
1 ebs Amazon Elastic Block Store (Amazon EBS) - ブロックストレージ
2 s3-outposts Amazon S3 on Outposts - Outposts用S3ストレージ
3 s3tables S3 Tables - 分析用テーブルストレージ
4 elasticfilesystem Elastic File System - 共有ファイルシステム
5 elasticfilesystem-fips EFS FIPS準拠エンドポイント
6 fsx FSx - 高性能ファイルシステム
7 storagegateway ハイブリッドクラウドストレージ

データベース

🗄️ データベース(14サービス)
No. サービス名 説明
1 dynamodb-streams Amazon DynamoDB Streams - DynamoDB変更ストリーム
2 rds Amazon Relational Database Service (Amazon RDS)
3 rds-data Amazon RDS Data API
4 redshift Amazon Redshift - データウェアハウス
5 redshift-data Amazon Redshift Data API
6 redshift-serverless Amazon Redshift Serverless
7 elasticache Amazon ElastiCache - インメモリキャッシュ
8 memory-db Amazon MemoryDB for Redis - Redis互換インメモリDB
9 cassandra Amazon Keyspaces (for Apache Cassandra) - マネージドCassandra
10 neptune-graph Amazon Neptune Analytics - グラフデータベース
11 neptune-graph-data Amazon Neptune Analytics Data - Neptuneグラフデータアクセス
12 timestream-influxdb Amazon Timestream for InfluxDB - 時系列データベース
13 dsql Amazon Aurora DSQL - 分散SQLデータベース
14 dsql-jmr4 Amazon Aurora DSQL JMR4 - DSQL JMR4エンジン

AI・機械学習

🤖 AI・機械学習(23サービス)
No. サービス名 説明
1 bedrock Amazon Bedrock - 基盤モデルサービス
2 bedrock-agent Amazon Bedrock Agents - Bedrockエージェント
3 bedrock-agent-runtime Amazon Bedrock Agent Runtime - Bedrockエージェント実行時
4 bedrock-runtime Amazon Bedrock Runtime - Bedrock推論実行時
5 sagemaker.api Amazon SageMaker API
6 sagemaker.runtime Amazon SageMaker Runtime - SageMaker推論実行時
7 sagemaker.featurestore-runtime Amazon SageMaker Feature Store Runtime - 特徴量ストア実行時
8 sagemaker.metrics Amazon SageMaker Metrics - SageMakerメトリクス
9 sagemaker-data-science-assistant Amazon SageMaker Data Science Assistant
10 rekognition Amazon Rekognition - 画像・動画分析
11 comprehend Amazon Comprehend - 自然言語処理
12 polly Amazon Polly - テキスト読み上げ
13 transcribe Amazon Transcribe - 音声テキスト変換
14 transcribestreaming Amazon Transcribe Streaming - リアルタイム音声認識
15 translate Amazon Translate - 機械翻訳
16 personalize Amazon Personalize - 個人化推奨
17 personalize-events Amazon Personalize Events - Personalizeイベント
18 personalize-runtime Amazon Personalize Runtime - Personalize推論
19 forecast Amazon Forecast - 需要予測
20 forecastquery Amazon Forecast Query - 予測クエリ
21 lookoutmetrics Amazon Lookout for Metrics - 異常検知
22 lookoutvision Amazon Lookout for Vision - 産業用画像分析
23 voiceid Amazon Connect Voice ID - 音声認証

セキュリティ・認証

🔒 セキュリティ・認証(24サービス)
No. サービス名 説明
1 sts AWS Security Token Service (AWS STS) - 一時認証情報
2 kms AWS Key Management Service (AWS KMS) - 暗号化キー管理
3 kms-fips AWS KMS FIPS - KMS FIPS準拠エンドポイント
4 secretsmanager AWS Secrets Manager - シークレット管理
5 acm AWS Certificate Manager (ACM) - SSL証明書
6 acm-pca AWS Private Certificate Authority (AWS Private CA) - プライベート認証局
7 guardduty Amazon GuardDuty - 脅威検知
8 guardduty-data Amazon GuardDuty Data - GuardDutyデータ
9 securityhub AWS Security Hub - セキュリティ統合管理
10 securitylake Amazon Security Lake - セキュリティデータレイク
11 security-ir AWS Security Incident Response - セキュリティインシデント対応
12 inspector2 Amazon Inspector - 脆弱性評価
13 inspector-scan Amazon Inspector Container Scan - コンテナスキャン
14 macie2 Amazon Macie - データプライバシー保護
15 access-analyzer AWS IAM Access Analyzer - アクセス分析
16 auditmanager AWS Audit Manager - 監査管理
17 fms AWS Firewall Manager - Firewall Manager
18 fms-fips AWS Firewall Manager FIPS - FMS FIPS準拠
19 wafv2 AWS WAF - Web Application Firewall
20 wafv2-fips AWS WAF FIPS - WAF FIPS準拠
21 rolesanywhere AWS IAM Roles Anywhere - 外部ID連携
22 identitystore AWS IAM Identity Center - アイデンティティストア
23 verifiedpermissions Amazon Verified Permissions - 認可管理
24 signin AWS Sign-In - サインイン管理

監視・ログ

📊 監視・ログ(12サービス)
No. サービス名 説明
1 monitoring Amazon CloudWatch - 監視・メトリクス
2 logs Amazon CloudWatch Logs - ログ管理
3 xray AWS X-Ray - 分散トレーシング
4 cloudtrail AWS CloudTrail - API監査ログ
5 synthetics Amazon CloudWatch Synthetics - 合成監視
6 rum Amazon CloudWatch RUM - Real User Monitoring
7 rum-dataplane Amazon CloudWatch RUM Data Plane - RUMデータプレーン
8 evidently Amazon CloudWatch Evidently - 機能フラグ・A/Bテスト
9 evidently-dataplane Amazon CloudWatch Evidently Data Plane - Evidentlyデータプレーン
10 application-signals Amazon CloudWatch Application Signals - アプリケーション監視
11 oam Amazon CloudWatch Observability Access Manager - 可観測性アクセス管理
12 observabilityadmin Amazon CloudWatch Observability Admin - 可観測性管理

最後に

今回の件は、AWS Certified DevOps Engineer - Professional更新のために勉強していて気が付きました。基本を学び直す重要性について改めて感じました。

今回はQ Developer CLIに具体的なCDKソース、JSON等のサンプルを作ってもらいながら勉強しています。知りたいコードをピンポイントで作ってくれるQ Developer CLIくんできる子です!。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?