在 Twitter 上看到 Grafana 的帳號提到了一篇把 AWS Billing 資料接進 Grafana 上的文章:
How to setup AWS Billing metrics in Grafana Cloud via Terraform by @KoningsJohannes https://t.co/CpDmZlrIPm
— Grafana (@grafana) February 15, 2021
這個想法還頗不賴的,有些東西剛好可以交叉比對拉出來...
幹壞事是進步最大的原動力
在 Twitter 上看到 Grafana 的帳號提到了一篇把 AWS Billing 資料接進 Grafana 上的文章:
How to setup AWS Billing metrics in Grafana Cloud via Terraform by @KoningsJohannes https://t.co/CpDmZlrIPm
— Grafana (@grafana) February 15, 2021
這個想法還頗不賴的,有些東西剛好可以交叉比對拉出來...
Mastercard 規定在免費試用後 (實體物品),需要另外再讓使用者再同意一次才能開始收訂閱費用:「Free Trials Without The Hassle」。
The rule change will require merchants to gain cardholder approval at the conclusion of the trial before they start billing. To help cardholders with that decision, merchants will be required to send the cardholder – either by email or text – the transaction amount, payment date, merchant name along with explicit instructions on how to cancel a trial.
新聞一開始出來時其實讓蠻多人關注的,因為一堆網路服務都是靠這招... 所以 Mastercard 在文章後更新說明,目前只有實體物品套用這個規則:
*This blog was updated on January 17, 2019 to clarify that the rule change is applicable to physical products such as skincare, healthcare items etc.
現在 AWS 讓你可以設定,是否允許 Reserved Instance (RI) 跨帳號使用:「Customize your organization’s AWS credit and Reserved Instance (RI) discount sharing using new billing preferences」。
以往是優先用在自己帳號,但如果有剩的話可以挪去其他帳號用。這樣雖然比較省錢,但有時候會造成帳務的「困擾」:
Historically, AWS has maximized customer savings by applying credits and RI discounts first to the account that owned the credit or RI lease and then distributing the remainder, if any, to qualifying usage incurred by accounts in the same organization. While this approach had the potential of lowering the overall bill, customers were unable to control if, and how, discounts were applied across organizational lines.
現在則是可以關掉:
To provide greater flexibility, customers can now disable AWS credit sharing across all accounts in their organization. This ensures that only the account that owns a credit, or has previously redeemed a credit, receives the associated benefit.
也可以分開設定:
You can also designate a set of accounts for which RI discount sharing is disabled, while continuing to share RI discounts among the rest of the accounts in your organization.
這樣雖然會比較貴,但這其實反應到某些組織文化上的問題啦...
Amazon EC2 的 CRI (Convertible Reserved Instance) 支援一年的合約了:「EC2 Convertible Reserved Instance Update – New 1-Year CRI, Merges & Splits」,這樣彈性再多了一些:
Today we are introducing Convertible RIs with a 1-year term, complementing the existing 3-year term.
不過 CRI 主要是用在需要換 family type 的情境下,如果是已知 family type (像是一般性的 worker 會選 C4 或是剛推出的 C5) 那麼就直接選擇 Regional RI 就好...
基本上就是讓財務操作上多個選擇 :o
雖然只是 Amazon EC2 與 Amazon EBS 計價模式的改變,但這次 AWS 的改變對於許多開發流程有很大的影響 (重點在 EC2 的部份):「New – Per-Second Billing for EC2 Instances and EBS Volumes」。
10/2 開始改變 (而不是 10/1),低消一分鐘,Windows 機種以及需要額外收費的 Linux 機種不在範圍內:
This change is effective in all AWS Regions and will be effective October 2, for all Linux instances that are newly launched or already running. Per-second billing is not currently applicable to instances running Microsoft Windows or Linux distributions that have a separate hourly charge. There is a 1 minute minimum charge per-instance.
然後 Spot 與買 RI 後也是一樣以秒計價:
List prices and Spot Market prices are still listed on a per-hour basis, but bills are calculated down to the second, as is Reserved Instance usage (you can launch, use, and terminate multiple instances within an hour and get the Reserved Instance Benefit for all of the instances).
這次改變的影響很巨大。馬上可以想到幾個情境...
第一個是對於實踐 Release early, release often 的團隊來說,如果設計成每 deploy 一次就建一個新的 AMI (最乾淨的作法),再開新機器換掉的話,成本就會增加不少。所以對於這樣的團隊,就會偏好朝著替換現有目錄內的東西後重啟...
現在改成以秒計費後,直接透過 Blue-Green Deployment 就可以了 (AWS CodeDeploy 年初也支援了:「AWS CodeDeploy 支援 BlueGreenDeployment」):(如果不熟悉 Blue-Green Deployment 的話,更白話的說法就是「先建後拆」...)
同樣的理由,對於 Auto Scaling 的 policy 也有些改變。之前機器開起來都會想讓他跑一個小時,所以 scale down 的部份都會寫的比較鬆一點。現在就可以重新規劃了...
另外一個影響是對使用 container 的誘因少了不少。很多人用 container 的用法是開大台機器再裡面拆給不同服務用,讓資源利用率變高,現在變成用多少算多少後就不太需要這樣了...
當然也還是有缺點。以前 Spot Instance 如果被 AWS 收回時,最後的那個小時是不計費的。現在因為以秒計費,變成要收費了...
最後是 10/2 生效這件事情頗怪,該不會是財務部門不願意配合 10/1 星期天加班生效,所以只好變成 10/2 生效這種理由吧... XDDD
之前 AWS 的多帳號管理只是合併計費,要自己在不同帳號內設一堆 Role 互相切換,現在可以透過 AWS Organizations 掛起來一起管理了:「Announcing AWS Organizations: Centrally Manage Multiple AWS Accounts」。
現在還在 Preview,不過可以看到一些說明:
另外原來的計費管理 (consolidated billing) 也會轉移過去:
Note: If you currently use Consolidated Billing, your Consolidated Billing family is migrated automatically to AWS Organizations in Billing mode, which is equivalent to Consolidated Billing. All account activity charges accrued by member accounts are billed to the master account.
這次要提的是「Netflix Billing Migration to AWS」、「Netflix Billing Migration to AWS - Part II」與「Netflix Billing Migration to AWS - Part III」這三篇。
Netflix 先前的金流相關系統跑的是 Oracle 的資料庫:
然後換成 MySQL:
系統上是採用 DRBD,然後底層是 5 個 4TB 的 EBS 組成的 RAID 0,跑 LVM:
High performance with respect to reads and writes was achieved by using RAID0 with EBS provisioned IOPS volumes. To get more throughput per volume, 5 volumes of 4TB each were used, instead of 1 big volume. This was to facilitate faster snapshots and restores.
LVM to manage two Logical Volume’s (DB and DRBD Metadata) within single Volume Group.
可以看到裡面用的都是很經過時間考驗的技術,像是 DRBD、標準的 Replication 架構...
AWS 把價錢資訊也 API 化了:「New – AWS Price List API」。
除了可以透過 API 取得資訊外,還可以透過 Amazon SNS,在價錢有變動時得到通知:
You can also elect to receive notification via Amazon Simple Notification Service (SNS) each time we make a price change.
讓 billing 的各種計算變方便。
昨天 AWS 推出的新功能,讓 IAM 帳號可以使用 AWS Billing Console:「Additional IAM Support in the AWS Billing Console」。
這樣每個月報帳的時候就可以用 IAM 帳號登入進去看,而非用母帳號...
多了六個權限設定:{View,Modify}{Billing,Account,PaymentMethods}
,這六個權限都跟帳戶與帳務有關。