聊了一下 Amazon S3 Express One Zone 的用途...

昨天寫了「AWS 推出 Amazon S3 Express One Zone」這篇,剛好跟朋友聊了一下 Amazon S3 Express One Zone 的用途...

首先 Amazon S3 Express One Zone 這個產品的定位會是有多台機器需要存取同一包資料:如果是同一台機器要存取的話,放到 Amazon EBS 甚至是 local disk 上就好了。

另外可以知道 Amazon S3 Express One Zone 主要的服務對象不會是靜態資料:靜態資料可以先把所有的資料打包成一大包,丟到標準的 Amazon S3 上面跑,讓每一台機器下載下來,這樣 latency 的影響也會小很多。

所以可以抓到產品的定位:會是有很多機器需要存取同一包資料,而且這包資料會不斷更新。

但畢竟 Amazon S3 Express One Zone 還是要走 HTTPS 去跟 server 要資料,如果你在本地端使用 EBS 或是 local disk,latency 一定還是比較低;而且就程式的開發來說,比較直覺的方法還是在本地端直接弄一個 ext4 filesystem,然後跑很多 process 處理。

(而且這樣還有使用記憶體做的 filesystem cache,加上 EBS 的儲存費用還比 Amazon S3 Express One Zone 便宜)

所以 Amazon S3 Express One Zone 的定位又再被縮小到一台 EC2 instance 沒辦法完成上一段提到的情境。

如果再把前幾天新推出的機器拿來看:「AWS 推出 32TB RAM 的機種 u7in-32tb.224xlarge」,這台新機器是 896 vCPU + 32TB RAM,代表你每跑 896 個 process (假設程式還沒用 threading 打散),而每個 process 可以吃 36GB RAM...

算過以後就會發現,這是個 scale up 可以暴力解很多問題的年代,只要你的演算法不是 n^2 這類的 case...

但回到這個產品的定位,從上面的推敲可以找出還是有對應的需求方,而且知道這是一個比較小眾的產品線,但遇到這種問題的人都會是大型客戶,這樣去思考為什麼會推出 Amazon S3 Express One Zone 就合理多了。

AWS 推出 Amazon S3 Express One Zone

AWS 推出了以效能為導向的 Amazon S3 Express One Zone:「Announcing the new Amazon S3 Express One Zone high performance storage class」。

從名字裡的 One Zone 可以看到這是只有在一個 AZ,主打超低 latency:

The new Amazon S3 Express One Zone storage class is designed to deliver up to 10x better performance than the S3 Standard storage class while handling hundreds of thousands of requests per second with consistent single-digit millisecond latency, making it a great fit for your most frequently accessed data and your most demanding applications.

但費用相當貴,以 us-east-1 來看的話是 $0.16/GB/mo,如果拿其他一些 storage 方案來比,可以看到非常大的差距:

  • S3 Standard:$0.023/GB/mo
  • General Purpose SSD (gp3):$0.08/GB/mo
  • General Purpose SSD (gp2):$0.1/GB/mo

可以猜測後面應該全是 NVM 之類的 storage (不過文章裡沒有提到)。

這次的 Amazon S3 Express One Zone 也多出了很多特別的限制。

首先是新的 bucket type,在這個 bucket type 下面 ListObjectsV2 呼叫就必須以 / 結尾 (這暗示後面的資料處理有對這點 optimization),另外傳回的資料不保證順序了:

The path delimiter must be “/“, and any prefixes that you supply to ListObjectsV2 must end with a delimiter. Also, list operations return results without first sorting them, so you cannot do a “start after” retrieval.

另外看起來是在 AZ 裡面直接認證,所以有新的 authentication model:

The new CreateSession function returns a session token that grants access to a specific bucket for five minutes.

然後 bucket naming 因為有後處理,在命名上不需要在整個 AWS 是唯一的 (因為被加料了):

Directory bucket names must be unique within their AWS Region, and must specify an Availability Zone ID in a specially formed suffix. If my base bucket name is jbarr and it exists in Availability Zone use1-az5 (Availability Zone 5 in the US East (N. Virginia) Region) the name that I supply to CreateBucket would be jbarr--use1-az5--x-s3.

另外資料還是可以在同一個 region 下跨 AZ 存取,而且同一個 region 下面的 compute resources (像是 EC2) 不收傳輸費用:

Although the bucket exists within a specific Availability Zone, it is accessible from the other zones in the region, and there are no data transfer charges for requests from compute resources in one Availability Zone to directory buckets in another one in the same region.

費用的部分還有個比較特別的但書,超過 512KB 的 request 會需要額外收費:

You pay an additional per-GB fee for the portion of any request that exceeds 512 KB. For more information, see the Amazon S3 Pricing page.

主要是給自己開發的應用程式用的,現有的 framework 大多都有利用 batch & buffering 的技巧降低 latency 所帶來的效能影響。

平常應該是用不太到,但就有個印象,真的在架構設計上跑不掉的時候有個選擇...

Google One 的使用者都有 VPN 服務可以用了...?

MacRumors 上面看到 Google 提供 VPN 服務給所有付費的 Google One 使用者使用:「All Paid Google One Subscribers Now Get VPN Access」。而 Google 的公告在這裡:「New security features for all Google One plans」。

主打隱私性,避免被追蹤 IP 位置之類的:

VPN by Google One adds more protection to your internet activity no matter what apps or browsers you use, shielding it from hackers or network operators by masking your IP address. Without a VPN, the sites and apps you visit could use your IP address to track your activity or determine your location.

看到這則留言,很貼切 XDDD

Google running a VPN is like McDonalds running an exercise gym.

不了謝謝 XDDD

Amazon EFS 推出 One Zone 版本

Amazon EFS 提供 One Zone 的版本,用較低的可靠度提供更低的價錢:「New – Lower Cost Storage Classes for Amazon Elastic File System」。

價錢大約是 53 折,不過要注意不在同一個 AZ 時使用會有頻寬費用:

Standard data transfer fees apply for inter-AZ or inter-region access to file systems.

目前想的到的是 /net/tmp 這類的用途,資料掉了也就算了,考慮到可靠度,其他的用途好像暫時想不到...

讓手機上瀏覽器自動帶出數字鍵盤的方式

在「HTML attributes to improve your users' two factor authentication experience」這邊看到關於讓使用者輸入 2FA (通常是數字) 比較流暢的設定。

原始是上面這張這樣,目標是希望下面這張這樣,當透過 SMS 2FA 時可以提供選項直接貼上,而且也自動帶出數字鍵盤:

給出的幾個重點在於 inputmodepattern 以及 autocomplete

<input
  type="text"
  name="token"
  id="token"
  inputmode="numeric"
  pattern="[0-9]*"
  autocomplete="one-time-code"
/>

查了一下 caniuse.com 上面的支援度,pattern 基本上都支援了,autocomplete 在這邊用到的 one-time-code 基本上也沒問題,只有 inputmode 這邊支援度比較差,IE11 (基本上不會更新了)、FirefoxSafari 沒支援。

Amazon S3 推出新的等級 One Zone-IA

Amazon S3 有 RRS,提供給那些掉了可以重新產生的資料使用 (像是縮圖);另外也有 IA,提供給不常存取的資料使用。現在推出的這個等級結合了兩者,使得價錢更低:「Amazon S3 Update: New Storage Class and General Availability of S3 Select」。

New S3 One Zone-IA Storage Class – This new storage class is 20% less expensive than the existing Standard-IA storage class. It is designed to be used to store data that does not need the extra level of protection provided by geographic redundancy.

把 CSC (卡片背面的三碼) 變成 OTP (動態密碼)

把信用卡背面的後三碼 (Card security code) 變成動態密碼,雖然一般只會有三碼,但對於網路消費應該會有不少幫助,不過這樣就不能完全不拿出卡片了...:「This high-tech card is being rolled out by French banks to eliminate fraud」。

產品叫做 MotionCode,會先從法國開始:

Today both Société Générale and Groupe BPCE, two of France’s largest banking groups, are preparing to roll out these cards across all their customers after completing a pilot scheme last year.

然後是波蘭、墨西哥以及英國在規劃:

There are other pilots underway in Poland and Mexico, and Davis is running Oberthur’s UK operation with the hope of getting a pilot or trial started with a UK bank soon.

歷史上的爆炸記錄?

在「a brief history of one line fixes」列出了許多經典的問題...

裡面最有印象的還是 2008 年 Debian OpenSSL 問題,也因為這個問題影響太嚴重,後來預設會安裝 openssl-blacklist 這個套件,在連線時檢查是不是有問題的 key...

然後 Android memset() 那個很精彩啊 XDDDDDDDDDDD

WordPress.com 也支援 OTP 了...

WordPress.com 前幾天宣佈支援 One Time Password (OTP,動態密碼):「Greater Security with Two Step Authentication」。

因為是使用 HOTPTOTP,所以可以使用 Google Authenticator (Android) 或是 Google Authenticator (iOS) 當做 OTP software。

不過用手機跑 OTP software 的安全性還是沒有傳統實體 token 的高 (可以藉由 OS exploit 取得 key),像 AWS 就同時有提供實體 OTP 與 HOTP+TOTP 的版本...

不過 AWS 的實體 OTP 低成本應該是靠 AWS 量而壓出來 (靠 IAM 一個帳號設很多子帳號,每個子帳號都可以設定要不要用 OTP),這部份 WordPress.com 沒有這個需求。另外 WordPress.com 的資料似乎沒有 AWS 吸引人,所以...

大概還是不會設 OTP 吧...