vishwamitrasabharwal5762-del/Serverless-Disaster-Management-SOS-Dashboard
GitHub: vishwamitrasabharwal5762-del/Serverless-Disaster-Management-SOS-Dashboard
基于 AWS 无服务器架构的实时灾难管理与 SOS 仪表板,实现求助上报、地图可视化和多通道通知。
Stars: 0 | Forks: 0
AWS Access Key ID: [粘贴你的 Access Key ID]
AWS Secret Access Key: [粘贴你的 Secret Access Key]
Default region name: ap-south-1
Default output format: json# 🚨 ResQ Cloud — 无服务器灾难管理与 SOS 仪表板
### 云计算项目 | 4人小组
## 📁 项目结构
```
sos-dashboard/
├── frontend/
│ └── index.html ← Main dashboard (open in browser)
├── backend/
│ └── lambda/
│ ├── sos_handler.py ← Lambda: receives SOS, saves to DB, sends alerts
│ └── get_alerts.py ← Lambda: returns all alerts for the map
├── infrastructure/
│ └── cloudformation.yaml ← One-click AWS infrastructure deployment
├── deploy.sh ← Automated deployment script
└── README.md ← This file
```
## 🏗️ 架构概述
```
[User presses SOS button]
│
▼
[API Gateway — HTTPS]
│
▼
[AWS Lambda: sos_handler.py] ← Serverless, scales to ∞
│
├──► [DynamoDB Table] ← Stores alert (GPS, name, type, time)
│ │
│ └──► [Dashboard polls every 10s → Live Map updates]
│
└──► [SNS Topic] ← Fan-out in parallel
│
├──► Email → Rescue Team
├──► SMS → Local Authorities
└──► (Extendable: WhatsApp, PagerDuty, etc.)
```
## ☁️ 使用的 AWS 服务
| 服务 | 用途 | 为何属于“云” |
|---|---|---|
| **AWS Lambda** | 运行 SOS 逻辑 | 无服务器 — 可扩展至百万级,空闲时成本为 $0 |
| **Amazon DynamoDB** | 存储所有警报 | NoSQL,自动扩容,个位数毫秒级延迟 |
| **Amazon SNS** | 扇出通知 | 发布/订阅模型 — 一个事件 → 多个订阅者 |
| **API Gateway** | 前端的 HTTPS 端点 | 托管服务,处理 SSL,速率限制 |
| **CloudFormation** | 基础设施即代码 | 使用一条命令即可部署整个技术栈 |
## 🚀 如何运行 — 分步指南
### 前置条件
- 一个 AWS 账户(免费套餐即可)
- 在你的计算机上安装 AWS CLI
- 一个文本编辑器(推荐使用 VS Code)
### 阶段 1 — 设置 AWS CLI(一次性)
**步骤 1:** 下载 AWS CLI
- Windows: https://aws.amazon.com/cli/ → 下载安装程序
- Mac: `brew install awscli`
- Linux: `sudo apt install awscli`
**步骤 2:** 配置凭证
```
aws configure
```
输入:
```
AWS Access Key ID: [from AWS Console → IAM → Users → your user → Security Credentials]
AWS Secret Access Key: [from same place]
Default region name: ap-south-1
Default output format: json
```
### 阶段 2 — 部署到 AWS(5 分钟)
**步骤 3:** 在项目文件夹中打开终端
```
cd sos-dashboard
```
**步骤 4:** 编辑 deploy.sh — 修改以下两行:
```
REGION="ap-south-1" # Keep as Mumbai, or change to your region
ALERT_EMAIL="your-email@example.com" # ← PUT YOUR REAL EMAIL HERE
```
**步骤 5:** 运行部署脚本
```
bash deploy.sh
```
这将:
- 自动创建所有 AWS 资源
- 上传 Lambda 代码
- 输出你的 API URL
**步骤 6:** 检查你的电子邮件并**确认 SNS 订阅**
(AWS 会发送一封确认邮件 — 点击 "Confirm subscription")
### 阶段 3 — 连接前端
`deploy.sh` 完成后,会自动修补 `frontend/index.html`。
如果你需要手动操作:
**步骤 7:** 在文本编辑器中打开 `frontend/index.html`。
找到这一行(在 `