Chebis26/aws-landing-zone

GitHub: Chebis26/aws-landing-zone

基于 Terraform 构建的企业级 AWS 多账户 Landing Zone,提供自动化账户开通、集中式日志记录和安全合规护栏,解决大规模云环境下的治理难题。

Stars: 0 | Forks: 0

# AWS 企业 Landing Zone [![Terraform](https://img.shields.io/badge/Terraform-1.7+-623CE4?logo=terraform)](https://www.terraform.io/) [![AWS](https://img.shields.io/badge/AWS-Multi--Account-FF9900?logo=amazon-aws)](https://aws.amazon.com/) [![许可证](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![安全](https://img.shields.io/badge/Security-Hardened-green)](docs/SECURITY.md) 这是一个生产级、企业规模的 AWS Landing Zone,实现了 AWS 在多账户治理、安全和合规方面的最佳实践。该解决方案遵循 AWS Well-Architected Framework,提供了一个完全自动化、可重复的 AWS 环境。 ## 执行摘要 在 AWS 上扩展的组织面临着在数十或数百个账户中维护安全和治理的挑战。此 Landing Zone 提供了一个经过实战检验的基础,可强制执行安全护栏、实现集中式日志记录,并加速账户开通——将新账户的配置时间从数周缩短至数小时。 ## 解决的业务问题 | 挑战 | 解决方案 | |-----------|----------| | 账户蔓延与不一致的安全性 | AWS Organizations + SCPs 在所有账户中强制执行基线控制 | | 手动创建账户耗时数天 | 通过 Terraform 自动开通账户 | | 无集中式审计追踪 | CloudTrail + S3 集中式日志记录,采用不可变存储 | | IAM 凭据蔓延 | 权限边界 + 最小权限 IAM 角色 | | 合规性随时间推移发生漂移 | AWS Config 规则与自动修复 | ## 架构概述 ``` ┌─────────────────────────────────────────────────────────────────┐ │ AWS Organizations Root │ │ │ │ ┌──────────────────┐ ┌──────────────────────────────────┐ │ │ │ Management │ │ Organizational Units │ │ │ │ Account │ │ │ │ │ │ │ │ ┌──────────┐ ┌─────────────┐ │ │ │ │ • Control Tower │ │ │ Security │ │ Workloads │ │ │ │ │ • Org Master │ │ │ OU │ │ OU │ │ │ │ │ • Billing │ │ │ │ │ │ │ │ │ └──────────────────┘ │ │ Log Arch │ │ ┌───────┐ │ │ │ │ │ │ Security │ │ │ Dev │ │ │ │ │ ┌──────────────────┐ │ │ Tooling │ │ │ Stg │ │ │ │ │ │ SCPs Applied │ │ └──────────┘ │ │ Prod │ │ │ │ │ │ at OU Level │ │ │ └───────┘ │ │ │ │ │ • Deny regions │ │ ┌──────────┐ └────────────┘ │ │ │ │ • Require tags │ │ │Infra/Ops │ │ │ │ │ • Deny root use │ │ │ OU │ │ │ │ │ • Enforce MFA │ │ └──────────┘ │ │ │ └──────────────────┘ └──────────────────────────────────┘ │ └─────────────────────────────────────────────────────────────────┘ ``` ## 仓库结构 ``` aws-landing-zone/ ├── .github/ │ └── workflows/ # CI/CD pipelines ├── terraform/ │ ├── modules/ │ │ ├── organizations/ # AWS Organizations + OUs │ │ ├── iam/ # IAM roles, policies, boundaries │ │ ├── scp/ # Service Control Policies │ │ └── logging/ # Centralized logging setup │ └── environments/ │ ├── prod/ # Production configuration │ └── dev/ # Development configuration ├── docs/ │ ├── architecture/ # Architecture diagrams + decisions │ └── runbooks/ # Operational runbooks ├── scripts/ │ ├── python/ # boto3 automation scripts │ └── bash/ # Shell automation scripts ├── CHANGELOG.md ├── SECURITY.md └── LICENSE ``` ## 功能 - **多账户结构** — 管理、安全、日志归档和工作负载账户 - **服务控制策略** — 在规模上防止安全错误配置的护栏 - **集中式日志记录** — 将 CloudTrail、Config 和 VPC Flow Logs 存入不可变的 S3 - **IAM 权限边界** — 防止在所有账户中发生权限提升 - **账户开通** — 具备基线控制的自动化新账户创建 - **标记策略** — 强制执行成本分配和资源标记 - **区域限制** — 将工作负载锁定在已批准的 AWS 区域 - **Root 账户保护** — 针对 Root 账户活动的 SCPs 和警报 ## 前置条件 | 工具 | 版本 | 用途 | |------|---------|---------| | Terraform | >= 1.7 | 基础设施配置 | | AWS CLI | >= 2.x | AWS API 访问 | | Python | >= 3.11 | 自动化脚本 | | Git | >= 2.x | 版本控制 | ## 快速开始 ### 1. 克隆与配置 ``` git clone https://github.com/Chebis26/aws-landing-zone.git cd aws-landing-zone ``` ### 2. 设置 AWS 凭据 ``` export AWS_PROFILE=management-account export AWS_DEFAULT_REGION=us-east-1 ``` ### 3. 初始化 Terraform ``` cd terraform/environments/prod terraform init terraform plan -out=tfplan ``` ### 4. 审查并应用 ``` terraform show tfplan terraform apply tfplan ``` ## 安全控制 | 控制 | 实现 | 范围 | |---------|---------------|-------| | 强制 MFA | 无 MFA 时 SCP 拒绝访问 | 所有账户 | | Root 账户锁定 | SCP + GuardDuty 警报 | 管理 | | 区域限制 | SCP 允许列表 | 所有 OUs | | CloudTrail | 多区域、日志验证 | 所有账户 | | Config 规则 | 托管 + 自定义规则 | 所有账户 | | GuardDuty | 集中式调查结果 | 安全账户 | ## 成本优化 - AWS Organizations 合并计费与 Reserved Instance 共享 - 用于日志数据的集中式 S3 生命周期策略 (S3 IA → Glacier) - 通过 SCP 强制执行成本分配标签 * 预估基线成本:基础账户每月约 $50-150 ## 灾难恢复 | 组件 | RPO | RTO | 策略 | |-----------|-----|-----|----------| | Terraform state | 0 | 15 分钟 | S3 版本控制 + DynamoDB 锁 | | CloudTrail 日志 | 0 | 1 小时 | S3 跨区域复制 | | Config 快照 | 1 小时 | 2 小时 | S3 CRR 至 DR 区域 | ## 监控 - 针对 Root 账户使用情况的 CloudWatch Alarms - 路由至 Security Hub 的 GuardDuty 调查结果 - 用于 SCP 违规警报的 EventBridge 规则 - Config 合规仪表板 ## 部署指南 有关完整的分步部署指南,请参阅 [docs/runbooks/deployment.md](docs/runbooks/deployment.md)。 ## 架构决策记录 有关涵盖设计决策的所有 ADR,请参阅 [docs/architecture/](docs/architecture/)。 ## 贡献 有关开发指南,请参阅 [CONTRIBUTING.md](CONTRIBUTING.md)。 ## 许可证 MIT 许可证 — 详见 [LICENSE](LICENSE)
标签:AWS, DPI, ECS, Terraform, 多云管理, 应用安全, 运维工具, 逆向工具