系统与基础设施david-codes.hatanian.com
每个程序员都该知道的 AWS 成本知识
AWS costs every programmer should know
2019 — 2022,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
这篇文章梳理了每个程序员都应该了解的 AWS 核心成本单价,如 vCPU、内存、存储等的大致月费,帮助开发者在设计系统时对云开销有直觉。评论区补充了带宽/出口流量这一被原文忽视的关键成本,并围绕云与自建服务器、过度架构等话题展开讨论。
为什么经久不衰:云成本是每个工程决策都绕不开的现实问题,文中给出的单价数量级和评论区的补充(尤其是出口流量之贵)至今仍然适用。
HN 评论精选
原文 vCPU 单价估算偏高,且漏掉了最该知道的出口流量成本
文中“每 vCPU 每月 58 美元”显然是取了所有实例类型的中位数,把带 GPU 或超大内存的高端实例也算进去了。真实的 vCPU 单价更接近每月 25 美元:m5.large(2 vCPU + 8GB,约 70 美元/月)折算下来 1 vCPU + 4GB 约 35 美元,Google Cloud 明确标价 vCPU 为 24 美元/月,AWS 考虑内存成本后也差不多。另外忽略网络成本是个大疏漏——如果只能让工程师记住一条 AWS 成本知识,我希望是数据中心出口流量贵得离谱。
013a查看英文原文
Just looking at the quote of "$58/mo for a vCPU", they're clearly taking the median cost of a vCPU across all instance types, which includes hyper-expensive instances with value-adds like GPUs or tons of memory. The real, distinct cost of a vCPU is probably closer to $25/mo. You can look at a m5.large instance, their "general purpose" instance, 2vCPU+8gb @ $70/mo, which would put 1vCPU+4gb at $35/mo. Google Cloud specifically lists the distinct price of a vCPU in custom instances as $24/mo, and AWS feels close to that when you consider the cost of memory in that $35/mo. The lack of networking cost also seems like a big oversight; if I could force every engineer to know a single "AWS Cost" that affects every vertical of development, from frontend to backend, I want them to know how crazy expensive DC egress is.
带宽密集型应用在 AWS 上成本极高,用 Cloudflare 等方案可省下巨额费用
对某些应用来说,AWS 的带宽成本贵得离谱。比如漫画站 mangadex.org 每月图片流量超过 1PB,若建在 AWS 上,即使按 CloudFront/S3 最低的 0.02 美元/GB 计算也要每月 2 万美元。他们最终用 Cloudflare 的不限流量带宽做到了零成本(后来被限速,升级到每月 200 美元的套餐就解决了)。
zawerf查看英文原文
For certain apps, bandwidth cost is stupid expensive on AWS. For example I've been following the development of an online manga reading site (mangadex.org) that is now pushing over 1PB/month of images. If they had built it on aws, even at the lowest rate of $0.02/GB with cloudfront/S3, it would be $20,000 per month. But they ended up paying nothing by using cloudflare who gave them unmetered bandwidth. (well, until they got throttled earlier this year but they got out of that by upgrading to a measly $200/month plan)
出口流量每 GB 约 9 美分,是很多应用最核心的 AWS 成本
奇怪的是带宽/流量/出口在这篇文章里像是事后才想起的,而且文中的数字恐怕也不对。AWS 的出站带宽最低也要每 GB 9 美分,这是巨大的数字,对很多应用来说就是主要成本。看到标题时我就想:关于 AWS 你只需要知道一个数字——每 GB 9 美分。
andrewstuart查看英文原文
It is strange that bandwidth/traffic/egress seems to be an afterthought in this post and I think the numbers in the linked blog post are wrong anyway. Bandwidth out of AWS is at best 9 cents per gigabyte, which is HUGE and for many applications the primary cost. Indeed when I saw the title of the post I thought "there's only one number you need to know with AWS, it's 9 cents per gigabyte". Please correct me if I am wrong. I went looking to find the correct number but as always it is hard to find the exact prices.
云看起来贵是因为打包了自建时的隐性运维成本,比较要公平
拿云成本和自建机房比较常常是拿苹果比梨。抱怨“1000 美元能买的服务器云上要 4000 美元一年”的人忽略了大量隐性成本:恒温机房及维护、每年 5-10 万美元的运维人员、多条高带宽线路、硬件故障的持续开支、两三年一次的设备更换。云把这些都打包进了租金,所以看起来才显得贵。如果你有人才和技能、又需要精确控制硬件,就自建;但很多人宁愿专注自己擅长的事,乐意每年付几万美元给云厂商。
lbriner查看英文原文
The complaints about cloud costs vs on-prem often compare apples with pears. Complaining that a machine that "I could buy for $1000" costs like $4000/year on cloud missing an enormous number of costs that people don't consider as well as the reliability/availability that you are paying for. Do it the same on-prem and you need to include the costs for: * An air-conditioned room + maintenance (this could be very large if you are a big company) * How many staff at $50-100K per year to look after it * How to deal with internet reliability - do we need multiple high bandwidth broadband links at $1000+/month? * Ongoing op-ex costs for failed components. * Cap-ex replacement of hardware after 2-3 years The point of the cloud is that these costs are wrapped up in your rental cost so of course it looks high. If you have the people/skills and need control over exactly how your hardware is provisioned, go on-prem and good luck but plenty of us would rather concentrate on what we are good at and are happy to pay 50-100K per year to a cloud provider to do it for us.
历次讨论
同类还值得读
TTY 揭秘(2008)
The TTY demystified (2008)
经典文章深入剖析了 Unix/Linux 中 TTY 子系统的工作原理,包括线路规程、终端驱动、信号与控制字符等机制。
系统与基础设施上首页 11 次 · 2009–2025linusakesson.net编辑精选为什么 GNU grep 这么快
Why GNU grep is Fast
FreeBSD 邮件列表上一篇广为流传的帖子,解释 GNU grep 为什么快:核心在于 Boyer-Moore 字符串搜索算法配合精心优化的内部循环和 I/O,让程序在搜索时“…
系统与基础设施上首页 9 次 · 2010–2022lists.freebsd.orgXplain:为普通人讲解 X11
Xplain – Explaining X11 for the rest of us
《Xplain》是作者(HN 用户 Jasper_)写的一系列 X11 长文,用他在浏览器中重建的 X11 绘图模型做交互演示,讲解 X11 的绘图模型与窗口系统设计。
系统与基础设施上首页 6 次 · 2013–2020magcius.github.io编辑精选旋风教程:为 Linux 创建极小 ELF 可执行文件(1999)
A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux (1999)
breadbox 写于 1999 年的经典教程,主题是如何为 Linux 手工构造并裁剪出体积极小的 ELF 可执行文件。
系统与基础设施上首页 6 次 · 2007–2025muppetlabs.comPostgreSQL 内部原理
The internals of PostgreSQL
《The Internals of PostgreSQL》是一本免费在线书籍,系统讲解 PostgreSQL 的内部实现,包括查询处理、并发控制、WAL、缓冲区管理等核心机制。
系统与基础设施上首页 5 次 · 2017–2025interdb.jp编辑精选