2010-05-21
■[google][io]Google Storageの使い方 導入編
GoogleIOで発表になったGoogleStorageを使ってみる。
GoogleStorage
http://code.google.com/intl/ja/apis/storage/docs/overview.html
に詳しく書いてあるがざっくり説明すると
Internetにつながってたらどこからでも使うことが出来て
GsUtilコマンドかWebInterFaceから使うことが出来ます。
巨大で大量のバイナリデータを保存することが出来てデータはアメリカ国内の複数の
データセンターに分散して保存されます。保存した瞬間に必ずデータが更新されることを
保証されます。ファイル毎にACLを設定出来てSSLでのセキュアなアクセスが可能です。
制限
現在はPreviewなのでいくつかの制限があります。1アカウントあたり100GB、1000Bucketまで無償で使用できます。
料金
現在発表されている料金体系
- 容量
- $0.17/GB/month
- 帯域
- Upload data to Google
- + $0.10/GB
- Download data from Google
- + $0.15/GB for Americas and EMEA
- + $0.30/GB for APAC
- Upload data to Google
- Requests
- PUT, POST, LIST
- $0.01 per 1,000 requests
- GET, HEAD
- $0.01 per 10,000 requests
- PUT, POST, LIST
参考にS3の料金
- First 50 TB 99.999999999%
- $0.150 per GB / Month
- First 50 TB 99.99%
- $0.100 per GB / Month
- All Data Transfer In
- Free until June 30th, 2010**
- PUT, COPY, POST, or LIST
- $0.01 per 1,000 Requests
S3って、もうすぐ50TBまでだったらアップロードフリーになるのは凄いかも。全体的にS3の方が安い
使ってみる
下準備1 キーとシークレットの取得
GoogleStorageのマネージページにアクセスする > https://sandbox.google.com/storage/m/manage
new acces keyボタンをクリックするとアクセスキーとシークレットが生成される。
下準備2 ユーティリティーをインスコする
https://code.google.com/intl/ja/apis/storage/docs/gsutil.html#install
ドキュメントに従いツールをDLして、インスコする。私は、Pathを追加せずにgsutilとbotoフォルダを/usr/local/bin直下にコピーした。
バケットを作って、ファイルをアップロードする
%gsutil mb gs://a2cdata % gsutil cp 1977603095_fb7971e69e.jpg 1978160173_a3a5183800.jpg 1979227588_cdf15f6a7d.jpg 1995253276_cd6a2a1bb8.jpg gs://a2cdata Copying file://1977603095_fb7971e69e.jpg... Copying file://1978160173_a3a5183800.jpg... Copying file://1979227588_cdf15f6a7d.jpg... Copying file://1995253276_cd6a2a1bb8.jpg... % gsutil ls gs://a2cdata gs://a2cdata/1977603095_fb7971e69e.jpg gs://a2cdata/1978160173_a3a5183800.jpg gs://a2cdata/1979227588_cdf15f6a7d.jpg gs://a2cdata/1995253276_cd6a2a1bb8.jpg
簡単すぎる。
Webインターフェースから見るとこうなってる
ログイン情報について
初めてgsutilを実行するとアクアセスキーとシークレットキーをプロンプトで聞かれる。また、gs://の他にs3://を使うとGoogleStorageとS3をシームレスに利用することが出来る。これらの情報は、~/.botoファイルに格納されている。また、プロキシーの設定も追記出来るのでFW内からも利用出来るぽい
# This file contains credentials and other configuration information needed # by the boto library, used by gsutil. You can edit this file (e.g., to add # credentials) but be careful not to mis-edit any of the variable names (like # "gs_access_key_id") or remove important markers (like the "[Credentials]" and # "[Boto]" section delimeters). # # This file was created by gsutil version "2010-05-16 19:36:15-07:00" # at 2010-05-20 13:16:10. [Credentials] # To add Amazon credentials ("s3://" URIs), edit and uncomment the # following two lines: #aws_access_key_id = <your Amazon access key ID> #aws_secret_access_key = <your Amazon secret access key> # The ability to specify an alternate storage host is primarily for developers. #aws_host = <alternate storage host address> # Google credentials ("gs://" URIs): gs_access_key_id = <your access key ID> gs_secret_access_key = <your Amazon secret access key> # The ability to specify an alternate storage host is primarily for developers. #gs_host = <alternate storage host address> [Boto] # To use a proxy, edit and uncomment the proxy and proxy_port lines. If you # need a user/password with this proxy, edit and uncomment those lines as well. #proxy = <proxy host> #proxy_port = <proxy port> #proxy_user = <your proxy user name> #proxy_pass = <your proxy password> # Set 'is_secure' to False to cause boto to connect using HTTP instead of the # default HTTPS. This is useful if you want to capture/analyze traffic # (e.g., with tcpdump). #is_secure = False # 'debug' controls the level of debug messages printed: 0 for none, 1 # for basic boto debug, 2 for all boto debug plus HTTP requests/responses. # Note: 'gsutil -d' sets debug to 2 for that one command run. #debug = <0, 1, or 2> # 'num_retries' controls the number of retry attempts made when errors occur. # The default is 5. #num_retries = <integer value>
- 407 http://www.google.co.jp/search?q=Google+Storage&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:ja:official&hl=ja&client=firefox
- 335 http://www.google.co.jp/url?sa=t&rct=j&q=google storage&source=web&cd=8&sqi=2&ved=0CH0QFjAH&url=http://d.hatena.ne.jp/a2c/20100521/1274393138&ei=SzaETteDMcbjmAXXsrkO&usg=AFQjCNGNXvB3P1GpEVN4V5wtm-XltHzv5Q
- 264 http://www.google.co.jp/search?sourceid=chrome&ie=UTF-8&q=google+storage
- 112 http://www.google.co.jp/url?sa=t&rct=j&q=google+storage&source=web&cd=3&ved=0CFgQFjAC&url=http://d.hatena.ne.jp/a2c/20100521/1274393138&ei=zZHHTpW-H6TLmAWCoNgL&usg=AFQjCNGNXvB3P1GpEVN4V5wtm-XltHzv5Q&sig2=GVbpy2uOgd8HXLN9G18sYg
- 107 http://www.google.co.jp/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&cts=1331255124819&ved=0CFYQFjAC&url=http://d.hatena.ne.jp/a2c/20100521/1274393138&ei=T1dZT_SXOMTImQWLlM2zDw&usg=AFQjCNGNXvB3P1GpEVN4V5wtm-XltHzv5Q&sig2=4_VPM-e9daCxxgTWEepK_Q
- 95 http://www.google.co.jp/search?aq=f&sourceid=chrome&ie=UTF-8&q=google+storage
- 91 http://www.google.co.jp/search?client=safari&rls=en&q=Google+Storage&ie=UTF-8&oe=UTF-8&redir_esc=&ei=yvP1S8KINsfQcYrd4fcL
- 76 http://www.google.co.jp/search?hl=ja&q=google+storage&lr=lang_ja
- 76 http://www.google.co.jp/url?sa=t&rct=j&q=google storage使い方&source=web&cd=1&ved=0CB4QFjAA&url=http://d.hatena.ne.jp/a2c/20100521/1274393138&ei=8NuETpOeK4ncmAXKyfUE&usg=AFQjCNGNXvB3P1GpEVN4V5wtm-XltHzv5Q&kb=1
- 75 http://www.google.co.jp/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cts=1331028312697&ved=0CCkQFjAA&url=http://d.hatena.ne.jp/a2c/20100521/1274393138&ei=YuFVT-CFHZD5mAWy3_jkCQ&usg=AFQjCNGNXvB3P1GpEVN4V5wtm-XltHzv5Q&sig2=RClV-A_SwYvBDCRi35yafg


