HaloLight 后台管理系统的 AWS Amplify 部署版本,集成 Amazon Cognito、DynamoDB、S3、Lambda@Edge 等 AWS 服务。
- AWS Amplify Hosting:全球 CDN 分发
- Amazon Cognito:企业级身份认证
- Lambda@Edge:边缘计算
- DynamoDB:无服务器数据库
- S3:对象存储
- CloudFront:全球内容分发
# 克隆仓库
git clone https://github.com/halolight/halolight-aws.git
cd halolight-aws
# 安装依赖
pnpm install
# 安装 Amplify CLI
pnpm add -g @aws-amplify/cli
# 配置 AWS
amplify configure
# 初始化 Amplify
amplify init
# 本地开发
pnpm dev- 登录 AWS Amplify Console
- 连接 GitHub 仓库
- 配置构建设置
- 部署
amplify push
amplify publishimport { Amplify } from 'aws-amplify';
import { signIn, signOut, getCurrentUser } from 'aws-amplify/auth';
Amplify.configure(awsConfig);import { generateClient } from 'aws-amplify/api';
const client = generateClient();import { uploadData, getUrl } from 'aws-amplify/storage';| 变量名 | 说明 |
|---|---|
NEXT_PUBLIC_AWS_REGION |
AWS 区域 |
NEXT_PUBLIC_USER_POOL_ID |
Cognito 用户池 ID |
NEXT_PUBLIC_USER_POOL_CLIENT_ID |
Cognito 客户端 ID |
halolight-aws/
├── amplify/ # Amplify 配置
│ ├── backend/ # 后端资源定义
│ └── hooks/ # 构建钩子
├── src/
│ ├── app/ # Next.js 页面
│ └── lib/aws/ # AWS 服务封装
└── amplify.yml # 构建配置