云存储成本优化完全指南

S3 层级
4-5层
IA/GLACIER
平均节省
30-70%
冷数据迁移
生命周期
自动
规则驱动
读取成本
需注意
GLACIER高

$ aws s3api put-bucket-lifecycle-configuration --bucket my-data-archive

存储是云账单中最容易被忽视的"沉默成本"。你可能每个月在 EBS volumes、Old snapshots、备份文件上花了大把钱却浑然不知。今天我们就来聊聊怎么优化你的云存储账单。

三大云厂商存储层级对比

AWS S3 存储层级

Azure Blob Storage 层级

GCP Cloud Storage 层级

存储成本浪费的常见原因

1. 僵尸资源

2. 存储层级选择错误

3. 未设置生命周期策略

数据生成后从未归档或删除。

生命周期策略配置

AWS S3 生命周期规则

{
  "Rules": [
    {
      "ID": "Archive-old-logs",
      "Status": "Enabled",
      "Filter": {"Prefix": "logs/"},
      "Transitions": [
        {"Days": 30, "StorageClass": "STANDARD_IA"},
        {"Days": 90, "StorageClass": "GLACIER"},
        {"Days": 365, "StorageClass": "DEEP_ARCHIVE"}
      ],
      "Expiration": {"Days": 2555}
    }
  ]
}

Azure Blob 生命周期管理

# Azure CLI
az storage account blob-service-properties update \
  --resource-group my-rg \
  --account-name mystorage \
  --enable-delete-retention true

GCP Storage 生命周期

gcloud storage buckets add-lifecycle-configuration gs://my-bucket \
  --lifecycle-file=lifecycle.json
小技巧:从 Glacier/Archive 层恢复数据需要时间(几分钟到几小时)。设置 lifecycle 时要考虑 RTO(恢复时间目标)。

优化策略实战

场景 1:日志归档

Web 服务器日志:

场景 2:数据库备份

PostgreSQL 备份文件:

场景 3:用户上传文件

用户上传的媒体文件:

EBS 存储优化

删除空闲 EBS Volumes

# 查找空闲 volumes(30天无 I/O)
aws cloudwatch get-metric-statistics \
  --namespace AWS/EBS \
  --metric-name VolumeIdleTime \
  --dimensions Name=VolumeId,Value=vol-xxxxx

快照清理策略

成本节省计算

假设你的存储桶当前有 100TB 全部在 S3 Standard:

存储优化关键要点:

云存储优化是最"一劳永逸"的 FinOps 实践——设置好策略,后台自动运行,省钱看得见!

$ share --net https://981263.xyz/S-003-Cloud-Storage-Optimization.html

Practical review before using this page

The S 003 Cloud Storage Optimization resource should be read together with the rest of Cloud Cost Optimization Dashboard, not as an isolated shortcut. Before acting on the page, write down the current baseline, the assumption you are making, and the result you expect to see. This makes the page more useful for comparison and reduces the chance of changing several variables at once.

For FinOps planning, cloud cost allocation, rightsizing, tagging governance, and monthly cost review, a good review habit is to separate stable facts from estimates. Stable facts might include dates, page URLs, account names, measured values, or the exact checklist items you completed. Estimates should be labeled as estimates and revisited later. If the result affects money, health, safety, compliance, or operational risk, use the page as preparation for a more careful review rather than as the final authority.

Common mistakes to avoid

Use this page as a planning reference before changing cloud accounts. Confirm pricing, contracts, and technical limits in the relevant provider console because cloud terms can change.