BalayogeshGopi/devsecops-aws-demo
GitHub: BalayogeshGopi/devsecops-aws-demo
基于 AWS 的端到端 DevSecOps 参考项目,演示如何通过 Terraform、GitHub Actions、安全扫描工具和 Kubernetes 实现安全、自动化的云原生应用交付与成本治理。
Stars: 0 | Forks: 0
# devsecops-aws-demo
[](https://github.com/BalayogeshGopi/devsecops-aws-demo/actions/workflows/ci.yml)
[](https://github.com/BalayogeshGopi/devsecops-aws-demo/actions/workflows/security.yml)



在 **AWS** 上的端到端 **DevSecOps 参考项目**,展示了我设计和保护云原生平台的方式:Infrastructure as Code、安全的 CI/CD pipeline、自动化安全扫描、容器/Kubernetes 部署以及 FinOps 成本可视化。
## 🧭 本仓库展示的内容
| 领域 | 工具 | 位置 |
| --- | --- | --- |
| Infrastructure as Code | Terraform (AWS VPC + ECR) | [`terraform/`](terraform/) |
| 示例应用 | Python · FastAPI | [`app/`](app/) |
| CI (构建 + 测试 + lint) | GitHub Actions | [`.github/workflows/ci.yml`](.github/workflows/ci.yml) |
| DevSecOps 扫描 | Trivy · tfsec · Gitleaks · Bandit | [`.github/workflows/security.yml`](.github/workflows/security.yml) |
| 部署 (OIDC → ECR → EKS) | GitHub Actions · AWS OIDC | [`.github/workflows/deploy.yml`](.github/workflows/deploy.yml) |
| 容器部署 | Docker · Kubernetes · Helm | [`k8s/helm/app/`](k8s/helm/app/) |
| FinOps 成本报告 | Python · AWS Cost Explorer | [`finops/`](finops/) |
## 🏗️ 架构
```
Developer ──push──▶ GitHub
│
┌────────────┴─────────────┐
▼ ▼
CI pipeline Security pipeline
(lint · test · build) (Trivy · tfsec · Gitleaks · Bandit)
│ │
▼ ▼
Docker image ──▶ Amazon ECR ──▶ Kubernetes (Helm) ──▶ Users
│
▼
FinOps cost reporting
```
## 🚀 快速开始
### 1. 在本地运行应用
```
cd app
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
uvicorn main:app --reload
# 打开 http://127.0.0.1:8000/health
```
### 2. 运行测试
```
cd app
pip install -r requirements-dev.txt
pytest -q
```
### 3. 配置基础设施 (Terraform)
```
cd terraform
terraform init
terraform plan
terraform apply # creates a demo VPC + ECR repository
```
### 4. 使用 Helm 部署
```
helm upgrade --install demo ./k8s/helm/app \
--set image.repository= \
--set image.tag=latest
```
### 5. 生成 FinOps 成本报告
```
cd finops
pip install -r requirements.txt
python cost_report.py --days 30
```
## 🔐 pipeline 中的安全控制
- **Trivy** — 容器镜像 + 文件系统漏洞扫描
- **tfsec** — Terraform 静态安全分析
- **Gitleaks** — 密钥检测
- **Bandit** — Python SAST
- 遇到 **HIGH/CRITICAL** 级别的发现时使构建失败(可配置)
## 📄 许可证
MIT — 请查看 [LICENSE](LICENSE)。
标签:DevSecOps, 上游代理, 云财务运营, 子域名突变, 安全扫描, 时序注入, 漏洞利用检测, 请求拦截, 逆向工具