実務Tips
AWS CLI コマンド
Section titled “AWS CLI コマンド”Web ACL管理
Section titled “Web ACL管理”# Web ACL作成aws wafv2 create-web-acl \ --name my-web-acl \ --scope REGIONAL \ --default-action Allow={} \ --rules file://rules.json \ --visibility-config SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=MyWebACL
# Web ACL一覧aws wafv2 list-web-acls --scope REGIONAL
# Web ACL詳細aws wafv2 get-web-acl \ --name my-web-acl \ --scope REGIONAL \ --id <web-acl-id>
# ALBに関連付けaws wafv2 associate-web-acl \ --web-acl-arn <web-acl-arn> \ --resource-arn <alb-arn>
# 関連付け解除aws wafv2 disassociate-web-acl \ --resource-arn <alb-arn>ベストプラクティス
Section titled “ベストプラクティス”優先順位: 1. ホワイトリスト(許可) 2. レート制限 3. マネージドルール 4. カスタムルール 5. デフォルトアクション
段階的適用: 1. Count モードで観察 2. ログ分析 3. 誤検知確認 4. Block モードへモニタリング
Section titled “モニタリング”CloudWatch Metrics: - BlockedRequests - AllowedRequests - CountedRequests
アラーム: - Block急増 - レート制限到達重要ポイント:
- マネージドルールから開始
- Count モードでテスト
- ログで継続的改善
- レート制限で コスト削減