AWS 大降價

在「AWS Price Reduction #42 - EC2, S3, RDS, ElastiCache, and Elastic MapReduce」這邊看到 AWS 降價的消息,明顯是被 Google 壓著推出來 :p

降價的範圍包括 EC2 instance、EC2 的 reserved instance、S3,以及對應的 RDSElastiCacheElastic MapReduce

前幾天買了兩台 us-west-2 c1.xlarge 的三年 RI,結果從 USD$2804 降到 USD$2524,現虧 USD$280 (XDDD),而每小時單價從 USD$0.124 降到 USD$0.112,也就 9.7% 左右。

另外 S3 的部份則是直接從 USD$0.085/GB 一次殺到 USD$0.03/GB 了,隨著使用量的增加的 discount 差不多都消失了。

等下再來研究好了,計畫永遠趕不上變化...

Google Drive 的降價...

前幾天的大消息:「Save more with Google Drive」。

本來是 USD$0.05/GB,這次 100GB 這邊降到 USD$0.02/GB,而 1TB 以上的方案變成是 USD$0.01/GB。

USD$0.01/GB 是 Amazon Glacier 等級的價錢,但不像 Amazon Glacier 是離線資料,取用時需要等三個小時...

在 S3 上儲存大量資料時要注意的事情

印象中要在 Amazon S3 上面存大量資料時需要注意 key 的命名,用 Google 找了找發現官方的「Request Rate and Performance Considerations」這篇。

文章中有提到這是對有大量存取需求時才需要注意的事項:

The guidelines in this section apply if you are routinely processing 100 or more requests per second. If your typical workload involves only occasional bursts of 100 requests per second or more, you don't need to follow the guidelines in this section.

不過平常即使沒有需要大量存取,還是可以照著做,因為應該不會有負面影響。如果能照著上面的方式先做,之後也許會受益...

由於 Amazon S3 是使用 key-prefix 當作 partition 的依據,所以 prefix 的值對於效能很重要。官方推薦的幾種方法都是對 key-prefix 下手:

  • 對整個 path + filename 的字串 hash 後當作 prefix。舉例來說,examplebucket/2013-26-05-15-00-00/cust1234234/photo1.jpg hash 後加到前面,名稱變成 examplebucket/232a-2013-26-05-15-00-00/cust1234234/photo1.jpg
  • 將最前面一段 reverse string。像是把 2134857/data/start.png 變成 7584312/data/start.png

AWS EC2 更新以及降價,以及 EBS 降價...

AWS 官方公告這一波改善:「AWS Update - New M3 Sizes & Features + Reduced EBS Prices + Reduced S3 Prices」。

首先是 EC2 多了 m3.medium 與 m3.large,與 m1.medium 與 m1.large 相比很有競爭力?

以 {m1,m3}.medium 比較來看,m3 的 ECU 值比 m1 高 50% (3 vs 2),而且有 SSD 硬碟 (雖然只有 4GB),價錢又比較便宜... 拿來跑 CPU bound 的 server 看起來就很好用啊?

另外一個超大的降價是 EBS,空間費用與 i/o 的費用都直接降 50%...

該來找人討論 KKTIX 要不要 migrate 過去了...

Netflix 對 S3 的 Eventually Consistency 的補強...

眾所皆知的,Netflix 幾乎將所有服務都放在 AWS 上,這當然也包括了 Amazon S3

在 Amazon S3 上會有 Eventually Consistency 的問題:寫入後可能會讀到舊的資料,於是就算錯資料了...

Netflix 的人討論了幾種方案,後來開發 s3mper 用來解決 Amazon S3 的 Eventually Consistency 問題:「S3mper: Consistency in the Cloud」。

s3mper 透過 AWS DynamoDB 儲存檔案的 metadata,藉以得知是否 consistency。而 Amazon DynamoDB 本身雖然也是 Eventually Consistency,但多了 API 可以得知是否 Consistency。

Supported Operations in DynamoDB 可以看到 Data Read and Consistency Considerations 這段提供了兩種 read mode:

  • Eventually Consistent Reads
  • Strongly Consistent Reads

在 Strongly Consistent Reads 中,可以確認讀到的是不是最新的資料。只有當 DynamoDB 與 S3 的資料都正確時才繼續往下跑...

這個解法相當於在 Amazon S3 上面架了一層防護網,算是 workaround 吧 :p 如果 Amazon S3 可以提供 consistency 資訊的話,也就不用這樣搞了...

Amazon S3 上 Protected Content 的 URL Sign...

Amazon S3 可以在上傳時設定為 non-public,這種檔案如果要讓使用者讀取,就必須透過 URL 簽名的方式...

官方的文件是「Authenticating REST Requests」這篇,不過官方文件把所有細節都寫上去,如果第一次接觸的人反而不知道要怎麼辦...

Thomas Riboulet 給了一個 Quickstart 的範例:「Signing Amazon S3 URLs」,裡面雖然是 Ruby code,不過 code 的邏輯很簡單...

以 test.gslin.org 為例,想要產生出從現在開始 3600 秒內有效的 url 可以這樣寫,用過一次後再回去看官方文件,就會發現其實就是官方文件的「REST Authentication Example 3: Query String Authentication Example」這段,如果以 PHP 寫會長這樣:

<?php

$access_key = "";
$secret_key = "";

$timestamp = time() + 3600;
$data = "GET\n\n\n${timestamp}\n/test.gslin.org/test.txt";

$sign = urlencode(
    base64_encode(
        hash_hmac('sha1', $data, $secret_key, true)
    )
);

echo "http://test.gslin.org.s3.amazonaws.com/test.txt?" .
    "AWSAccessKeyId=${access_key}&" .
    "Expires=${timestamp}&" .
    "Signature=${sign}\n";

接下來來研究 CloudFront 的部份...

Amazon S3 調降 request 本身的收費...

Amazon S3 的 request 費用大幅調降:「Announcing New Lower Request Pricing for Amazon S3」。

PUT/LIST/COPY/POST 的部份調降 50%,本來每千個是 USD$0.01 調降到 USD$0.005。而 GET 調降 60%,本來 USD$0.01 調降到 USD$0.004。

本來 CloudFront 可以降低 request 費用 (美國區每千個 GET 是 USD$0.0075),現在相比反而變貴... 還是過陣子 CloudFront 有機會再調降 request 費用?

AWS 的儲存空間降價 (S3 與 EBS)

雪梨也是同樣降幅,而且最高的 >5000TB 沒降,應該是因為 AWS re:Invent 辦這麼大,總是要有些東西看起來很炫?

降價範圍除了 Standard Storage 以外也包括 Reduced Redundancy Storage,降幅很大,從 24% 到 28% (約 1/4):「Amazon S3 Storage Price Reduction (24 to 28%)」。

其他幾個對手壓力很大啊 XD

Amazon Web Services 新的儲存方案:Amazon Glacier

Amazon Simple Storage Service (Amazon S3)AWS 第一代儲存服務。後來 S3 又提供了 Reduced Redundancy Storage,降低可靠度 (一年 99.99%) 換取價錢上的優勢,用在 cache file 之類的還蠻不錯。目前兩者在美東的價錢是 USD$0.125/GB 與 USD$0.093/GB。這兩種都是隨時可以存取的服務。

Amazon Glacier 則是提供超低的價錢與超高的可靠度:USD$0.01/GB 與一年 99.999999999%,而這是靠取回檔案的時間換來的。取回檔案需要排 3.5 到 4.5 小時的時間 (後面傳輸的時間另外計算):

Retrieving archives from Amazon Glacier requires the initiation of a job. Jobs typically complete in 3.5 to 4.5 hours.

是靠著機械手臂與軌道在處理嗎?

但這樣就多了很多用途啊... Data warehouse 是個很明顯的方向。目前可以透過 AWS Import/Export 匯入大量資料:

You can also use AWS Import/Export to accelerate moving large amounts of data into Amazon Glacier using portable storage devices for transport.

之後則是會提供從 S3 搬出去與搬進去的功能:

In the coming months, Amazon Simple Storage Service (Amazon S3) plans to introduce an option that will allow you to seamlessly move data between Amazon S3 and Amazon Glacier using data lifecycle policies.

等工具完整後再來研究 :p

AWS EC2 (以及使用 EC2 的加值服務) 降價,以及提昇存取 AWS S3 的效能...

AWS 宣佈 EC2 以及使用 EC2 的服務 (包括 RDS 與 ElastiCache) 降價:「New, lower pricing for Amazon EC2, RDS, and ElastiCache」,降價幅度在 Reserved Instances 比較大,但 On Demand Instances 的部份也有降一些。

Amazon.com 的 CTO Werner Vogels 也寫了一篇「Driving Compute Cost Down for AWS Customers」可以看看。

另外在「Amazon S3 Performance Tips & Tricks + Seattle S3 Hiring Event」這邊有 Doug Grismore (Director of Storage Operations for AWS) 寫了一篇客座文章,說明當量很大的時候要怎麼提昇對 AWS S3 存取的效能。這篇文章裡面有提到一些內部實做的結構,藉著了解這些內部結構,規劃檔案名稱,藉此提昇效能。