devops-platform-patterns

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

DevOps Platform Patterns

DevOps平台模式

Platform-specific verification checklists for infrastructure code.
针对基础设施代码的云平台专属验证检查清单。

DigitalOcean

DigitalOcean

CheckPassFail
VPC used for private networkingPrivate network configuredPublic networking only
Reserved IPs for productionStatic IPs assignedEphemeral IPs for critical services
Managed database in same regionCo-located DBCross-region latency
Spaces for state backendRemote state in SpacesLocal state only
Firewall attached to all dropletsFirewall rules appliedNo firewall
Best Practices:
  • Use
    digitalocean_vpc
    for internal communication
  • Attach firewalls via
    digitalocean_firewall
    with inbound rules
  • Store Terraform state in DigitalOcean Spaces with versioning
检查项合格不合格
使用VPC进行私有网络通信已配置私有网络仅使用公网
生产环境使用预留IP已分配静态IP关键服务使用临时IP
托管数据库与服务同区域数据库与服务同区域部署跨区域部署导致延迟
使用Spaces作为状态后端远程状态存储在Spaces中仅使用本地状态
所有Droplets均关联防火墙已应用防火墙规则未配置防火墙
最佳实践:
  • 使用
    digitalocean_vpc
    进行内部通信
  • 通过
    digitalocean_firewall
    关联防火墙并配置入站规则
  • 将Terraform状态存储在开启版本控制的DigitalOcean Spaces中

Hetzner

Hetzner

CheckPassFail
Private network configuredNetwork createdNo private networking
Firewall rules definedRules restrict accessOpen to internet
SSH keys managed via resource
hcloud_ssh_key
used
Keys in user_data only
Placement groups for HAServers distributedSingle point of failure
Best Practices:
  • Use
    hcloud_network
    +
    hcloud_network_subnet
    for internal traffic
  • Apply
    hcloud_firewall
    to all servers
  • Use placement groups with
    spread
    type for critical workloads
检查项合格不合格
已配置私有网络已创建私有网络未配置私有网络
已定义防火墙规则规则限制访问范围完全开放至互联网
通过资源管理SSH密钥使用
hcloud_ssh_key
管理
仅在user_data中配置密钥
使用放置组实现高可用服务器分布式部署存在单点故障
最佳实践:
  • 使用
    hcloud_network
    +
    hcloud_network_subnet
    处理内部流量
  • 为所有服务器应用
    hcloud_firewall
  • 针对关键工作负载使用
    spread
    类型的放置组

AWS

AWS

CheckPassFail
VPC with private subnetsMulti-AZ VPCDefault VPC usage
Security groups least-privilegeSpecific ports/IPs0.0.0.0/0 ingress
IAM roles over access keysInstance profilesHardcoded credentials
KMS encryption for dataCustomer-managed keysNo encryption
CloudTrail enabledAudit logging onNo audit trail
Best Practices:
  • Never use default VPC for production
  • Prefer
    aws_iam_role
    with instance profiles over access keys
  • Enable S3 bucket versioning and encryption by default
  • Use
    aws_kms_key
    for sensitive data encryption
检查项合格不合格
VPC配置私有子网多可用区VPC使用默认VPC
安全组遵循最小权限原则仅开放特定端口/IP入站规则允许0.0.0.0/0
使用IAM角色而非访问密钥使用实例配置文件硬编码凭证
使用KMS加密数据使用客户管理密钥未加密
已启用CloudTrail审计日志已开启无审计追踪
最佳实践:
  • 生产环境绝不使用默认VPC
  • 优先使用带实例配置文件的
    aws_iam_role
    而非访问密钥
  • 默认启用S3存储桶版本控制与加密
  • 使用
    aws_kms_key
    加密敏感数据

Cloudflare

Cloudflare

CheckPassFail
API tokens over global keyScoped tokensGlobal API key
WAF rules configuredProtection enabledNo WAF
SSL mode is strictFull (strict) modeFlexible SSL
Rate limiting on endpointsRules appliedNo rate limiting
Best Practices:
  • Create scoped API tokens per environment/purpose
  • Set SSL mode to
    strict
    for origin protection
  • Apply rate limiting to authentication endpoints
  • Enable Bot Management if available
检查项合格不合格
使用API令牌而非全局密钥使用范围限定的令牌使用全局API密钥
已配置WAF规则已启用防护未配置WAF
SSL模式为严格模式全(严格)模式灵活SSL模式
端点已配置速率限制已应用规则未配置速率限制
最佳实践:
  • 为每个环境/用途创建范围限定的API令牌
  • 将SSL模式设置为
    strict
    以保护源站
  • 为认证端点应用速率限制
  • 若可用则启用Bot Management

Cross-Platform Checks

跨平台检查项

CheckApplies ToVerification
Private networkingAllInternal services not exposed
Firewall/security groupsAllExplicit allow rules only
State backend remoteAllNot in local tfstate
Encryption at restAllData encrypted
Audit loggingAWS, CloudflareActivity tracked
检查项适用平台验证标准
私有网络通信所有平台内部服务不暴露至公网
防火墙/安全组配置所有平台仅配置明确的允许规则
远程状态后端所有平台不使用本地tfstate
静态数据加密所有平台数据已加密
审计日志AWS、Cloudflare活动已被追踪