AWS

S3cmdの使い方

  1. S3cmdパッケージをダウンロードします。ここから
  2. 自分のinstanceにアップロードし展開します。

※バケット(ディレクトリ)名はユニークな名前である必要がある

parameter

-v : verbosity
-d : see all 'debugging' output. 

初期設定する

hoge:/home/hogehoge/s3cmd-0.9.9.91# ./s3cmd --configure
Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.

Access key and Secret key are your identifiers for Amazon S3
Access Key:  <= Account >> Security Credentialsにある有効なAccess Key IDを入れる
Secret Key: <=上記に付随する秘密鍵を入れる

Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password: <= uploadする時に暗号化する為のパスワードを入れる
Path to GPG program [/usr/bin/gpg]: <=パス。変更がなければそのままEnter
  
When using secure HTTPS protocol all communication with Amazon S3
servers is protected from 3rd party eavesdropping. This method is
slower than plain HTTP and can't be used if you're behind a proxy
Use HTTPS protocol [No]: <= HTTPSを使うかどうか。

New settings:
 Access Key: 上記入力した物が表示される
 Secret Key: 上記入力した物が表示される
 Encryption password: 上記入力した物が表示される
 Path to GPG program: 上記入力した物が表示される
 Use HTTPS protocol: 上記入力した物が表示される
 HTTP Proxy server name: 
 HTTP Proxy server port: 

Test access with supplied credentials? [Y/n] Y
Please wait...
Success. Your access key and secret key worked fine :-)

Now verifying that encryption works...
Success. Encryption and decryption worked fine :-) 

Save settings? [y/N] <= 設定ファイルを保存するかどうか
Configuration saved to '/root/.s3cfg'

終了

一覧を見る(ls)

ディレクトリ単位で見る

hoge:/home/hogehoge/s3cmd-0.9.9.91# ./s3cmd ls
2010-09-29 20:09  s3://my_private_ami_dir

ディレクトリの中を見る

hoge:/home/hogehoge/s3cmd-0.9.9.91# ./s3cmd ls s3://my_private_ami_dir
2010-09-29 20:12     14100   s3://my_private_ami_dir/ReadMe.txt

バケット(フォルダー)を作る (mkdir)

hoge:/home/hogehoge/s3cmd-0.9.9.91# ./s3cmd mb s3://my-new-bucket-name
Bucket 's3://my-new-bucket-name/' created

ファイルをアップロードする(scp/PUT)

hoge:/home/hogehoge/s3cmd-0.9.9.91# ./s3cmd put README.txt s3://my_private_ami_dir/ReadMe.txt
README.txt -> s3://my_private_ami_dir/ReadMe.txt  [1 of 1]
0 of 0     0% in    0s     0.00 B/s  done

(アスタリスク)*も使える

hoge:/home/hogehoge/s3cmd-0.9.9.91# ./s3cmd put image*.jpg s3://my_private_ami_dir/ReadMe.txt

再帰的にファイルをアップロードする場合は

hoge:/home/hogehoge/s3cmd-0.9.9.91# ./s3cmd --recursive put ~/myfolder/* s3://my_private_ami_dir/myfolder/

アップロード先のPathにもアップしたい名前を入れないと第一層目のフォルダー名は作成されない

ファイルをダウンロードする(scp/GET)

hoge:/home/hogehoge/s3cmd-0.9.9.91# ./s3cmd get s3://my-new-bucket-name/ReadMe.txt otherReadMe.txt
s3://my-new-bucket-name/ReadMe.txt -> otherReadMe.txt  [1 of 1]
0 of 0     0% in    0s     0.00 B/s  done

ファイル/バケットを削除する(rm)

※バケットは空じゃないと削除出来ない

ファイルの削除

hoge:/home/hogehoge/s3cmd-0.9.9.91# ./s3cmd del s3://my-new-bucket-name/ReadMe.txt <= 複数列挙して一斉に削除出来る
File s3://my-new-bucket-name/ReadMe.txt deleted

バケットの削除

hoge:/home/hogehoge/s3cmd-0.9.9.91# ./s3cmd rb s3://my-new-bucket-name/
Bucket 's3://my-new-bucket-name/' removed

参考URL


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2012-03-12 (月) 16:54:28 (197d)