关于 aws-solution-architect
aws-solution-architect 是面向创业团队的 AWS 架构设计技能,可根据应用规模、预算和合规需求推荐方案,并生成基础设施即代码模板。还可分析现有资源成本并提出优化建议。
主要功能
- 01按需求推荐 AWS 架构模式
- 02生成 CloudFormation 模板
- 03提供 CDK TypeScript 示例
- 04分析成本并提出优化建议
- 05支持部署验证与故障排查
适用场景
- 01为 SaaS 或移动后端规划 AWS 架构
- 02为选定架构生成基础设施模板
- 03检查 AWS 月度成本并寻找节省空间
- 04部署后检查堆栈状态及失败原因
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ alirezarezvani/ claude-skills --skill aws-solution-architect安装后在 Claude Code 中输入/aws-solution-architect确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
assets/expected_output.jsonsample_input.jsonreferences/architecture_patterns.mdbest_practices.mdservice_selection.mdscripts/architecture_designer.pycost_optimizer.pyserverless_stack.py详细介绍
AWS 解决方案架构师
为初创企业设计可扩展、性价比高的 AWS 架构,并提供基础设施即代码模板。
工作流程
第 1 步:收集需求
收集应用规格:
- Application type (web app, mobile backend, data pipeline, SaaS)
- Expected users and requests per second
- Budget constraints (monthly spend limit)
- Team size and AWS experience level
- Compliance requirements (GDPR, HIPAA, SOC 2)
- Availability requirements (SLA, RPO/RTO)
第 2 步:设计架构
运行架构设计器以获取模式推荐:
python scripts/architecture_designer.py --input requirements.json
示例输出:
{
"recommended_pattern": "serverless_web",
"service_stack": ["S3", "CloudFront", "API Gateway", "Lambda", "DynamoDB", "Cognito"],
"estimated_monthly_cost_usd": 35,
"pros": ["Low ops overhead", "Pay-per-use", "Auto-scaling"],
"cons": ["Cold starts", "15-min Lambda limit", "Eventual consistency"]
}
从推荐的模式中选择:
- 无服务器 Web:S3 + CloudFront + API Gateway + Lambda + DynamoDB
- 事件驱动微服务:EventBridge + Lambda + SQS + Step Functions
- 三层架构:ALB + ECS Fargate + Aurora + ElastiCache
- GraphQL 后端:AppSync + Lambda + DynamoDB + Cognito
有关模式的详细规格,请参阅 references/architecture_patterns.md。
验证检查点: 在进入第 3 步之前,确认推荐的模式与团队的运维成熟度和合规要求相匹配。
第 3 步:生成 IaC 模板
为所选模式创建基础设施即代码:
# Serverless stack (CloudFormation)
python scripts/serverless_stack.py --app-name my-app --region us-east-1
示例 CloudFormation YAML 输出(核心无服务器资源):
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Parameters:
AppName:
Type: String
Default: my-app
Resources:
ApiFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs20.x
MemorySize: 512
Timeout: 30
Environment:
Variables:
TABLE_NAME: !Ref DataTable
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref DataTable
Events:
ApiEvent:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY
DataTable:
Type: AWS::DynamoDB::Table
Properties:
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: pk
AttributeType: S
- AttributeName: sk
AttributeType: S
KeySchema:
- AttributeName: pk
KeyType: HASH
- AttributeName: sk
KeyType: RANGE
包含 API Gateway、Cognito、IAM 角色和 CloudWatch 日志的完整模板由
serverless_stack.py生成,也可在references/architecture_patterns.md中找到。
示例 CDK TypeScript 代码片段(三层架构模式):
import * as ecs from 'aws-cdk-lib/aws-ecs';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as rds from 'aws-cdk-lib/aws-rds';
const vpc = new ec2.Vpc(this, 'AppVpc', { maxAzs: 2 });
const cluster = new ecs.Cluster(this, 'AppCluster', { vpc });
const db = new rds.ServerlessCluster(this, 'AppDb', {
engine: rds.DatabaseClusterEngine.auroraPostgres({
version: rds.AuroraPostgresEngineVersion.VER_15_2,
}),
vpc,
scaling: { minCapacity: 0.5, maxCapacity: 4 },
});
第 4 步:审查成本
分析预估成本和优化机会:
python scripts/cost_optimizer.py --resources current_setup.json --monthly-spend 2000
示例输出:
{
"current_monthly_usd": 2000,
"recommendations": [
{ "action": "Right-size RDS db.r5.2xlarge → db.r5.large", "savings_usd": 420, "priority": "high" },
{ "action": "Purchase 1-yr Compute Savings Plan at 40% utilization", "savings_usd": 310, "priority": "high" },
{ "action": "Move S3 objects >90 days to Glacier Instant Retrieval", "savings_usd": 85, "priority": "medium" }
],
"total_potential_savings_usd": 815
}
输出内容包括:
- 按服务划分的月度成本明细
- 资源规格调整建议
- Savings Plans 机会
- 潜在的月度节省金额
第 5 步:部署
部署生成的基础设施:
# CloudFormation
aws cloudformation create-stack \
--stack-name my-app-stack \
--template-body file://template.yaml \
--capabilities CAPABILITY_IAM
# CDK
cdk deploy
# Terraform
terraform init && terraform apply
第 6 步:验证并处理故障
验证部署并设置监控:
# Check stack status
aws cloudformation describe-stacks --stack-name my-app-stack
# Set up CloudWatch alarms
aws cloudwatch put-metric-alarm --alarm-name high-errors ...
如果堆栈创建失败:
- 检查失败原因:
aws cloudformation describe-stack-events \ --stack-name my-app-stack \ --query 'StackEvents[?ResourceStatus==`CREATE_FAILED`]' - 查看 Lambda 或 ECS 错误的 CloudWatch Logs。
- 修正模板或资源配置。
- 重试前删除失败的堆栈:
aws cloudformation delete-stack --stack-name my-app-stack # Wait for deletion aws cloudformation wait stack-delete-complete --stack-name my-app-stack # Redeploy aws cloudformation create-stack ...
常见故障原因:
- IAM 权限错误 → 验证
--capabilities CAPABILITY_IAM和角色信任策略 - 超出资源限制 → 通过 Service Quotas 控制台申请配额提升
- 模板语法无效 → 部署前运行
aws cloudformation validate-template --template-body file://template.yaml
工具
architecture_designer.py
根据需求生成架构模式。
python scripts/architecture_designer.py --input requirements.json --output design.json
输入: 包含应用类型、规模、预算、合规需求的 JSON 输出: 推荐模式、服务栈、成本估算、优缺点
serverless_stack.py
创建无服务器 CloudFormation 模板。
python scripts/serverless_stack.py --app-name my-app --region us-east-1
输出: 可用于生产环境的 CloudFormation YAML,包含:
- API Gateway + Lambda
- DynamoDB 表
- Cognito 用户池
- 遵循最小权限原则的 IAM 角色
- CloudWatch 日志
cost_optimizer.py
分析成本并推荐优化方案。
python scripts/cost_optimizer.py --resources inventory.json --monthly-spend 5000
输出: 以下方面的建议:
- 移除闲置资源
- 实例规格调整
- 预留容量购买
- 存储层级迁移
- NAT Gateway 替代方案
快速开始
MVP 架构(每月低于 100 美元)
Ask: "Design a serverless MVP backend for a mobile app with 1000 users"
Result:
- Lambda + API Gateway for API
- DynamoDB pay-per-request for data
- Cognito for authentication
- S3 + CloudFront for static assets
- Estimated: $20-50/month
扩展架构(每月 500-2000 美元)
Ask: "Design a scalable architecture for a SaaS platform with 50k users"
Result:
- ECS Fargate for containerized API
- Aurora Serverless for relational data
- ElastiCache for session caching
- CloudFront for CDN
- CodePipeline for CI/CD
- Multi-AZ deployment
成本优化
Ask: "Optimize my AWS setup to reduce costs by 30%. Current spend: $3000/month"
Provide: Current resource inventory (EC2, RDS, S3, etc.)
Result:
- Idle resource identification
- Right-sizing recommendations
- Savings Plans analysis
- Storage lifecycle policies
- Target savings: $900/month
IaC 生成
Ask: "Generate CloudFormation for a three-tier web app with auto-scaling"
Result:
- VPC with public/private subnets
- ALB with HTTPS
- ECS Fargate with auto-scaling
- Aurora with read replicas
- Security groups and IAM roles
输入要求
提供以下详细信息以进行架构设计:
| 需求 | 描述 | 示例 |
|---|---|---|
| 应用类型 | 您正在构建的内容 | SaaS 平台、移动后端 |
| 预期规模 | 用户数、每秒请求数 | 1 万用户、100 RPS |
| 预算 | AWS 每月限额 | 每月最多 500 美元 |
| 团队情况 | 人数、AWS 经验 | 3 名开发者、中级水平 |
| 合规 | 监管需求 | HIPAA、GDPR、SOC 2 |
| 可用性 | 正常运行时间要求 | 99.9% SLA、1 小时 RPO |
JSON 格式:
{
"application_type": "saas_platform",
"expected_users": 10000,
"requests_per_second": 100,
"budget_monthly_usd": 500,
"team_size": 3,
"aws_experience": "intermediate",
"compliance": ["SOC2"],
"availability_sla": "99.9%"
}
输出格式
架构设计
- 附带理由的模式推荐
- 服务栈示意图(ASCII)
- 月度成本估算及权衡分析
IaC 模板
- CloudFormation YAML:可直接用于生产环境的 SAM/CFN 模板
- CDK TypeScript:类型安全的基础设施代码
- Terraform HCL:兼容多云的配置
成本分析
- 当前支出明细及优化建议
- 优先级行动清单(高/中/低)与实施检查清单
参考文档
| 文档 | 内容 |
|---|---|
references/architecture_patterns.md | 6 种模式:无服务器、微服务、三层架构、数据处理、GraphQL、多区域 |
references/service_selection.md | 计算、数据库、存储、消息传递的决策矩阵 |
references/best_practices.md | 无服务器设计、成本优化、安全加固、可扩展性 |