menu
書いてる野郎
orebike@gmail.com
Developer Tools : Amazon Web Servicesをまずインストール。
Webの指示に従うと・・・zipをダウンロードして解凍して中のREADMEに従えと書いてあるな。そうしよう。
last update が 2009年なんだがこのツール大丈夫か?
Relational Data Service (RDS) Command Line Tools
================================================
Installation:
-------------
1. Ensure that JAVA version 1.5 or higher is installed on your system: (java -version)
2. Unzip the deployment zip file
3. Set the following environment variables:
3.1 AWS_RDS_HOME - The directory where the deployment files were copied to
check with:
Unix: ls ${AWS_RDS_HOME}/bin should list rds-describe-db-instances ...)
Windows: dir %AWS_RDS_HOME%\bin should list rds-describe-db-instances ...)
3.2 JAVA_HOME - Java Installation home directory
4. Add ${AWS_RDS_HOME}/bin (in Windows: %AWS_RDS_HOME%\bin) to your path
5. (Unix only) Set execute permissions on all files in the bin directory: chmod +x ${AWS_RDS_HOME}/bin/*
Configuration:
--------------
Provide the command line tool with your AWS user credentials. There are two ways you can provide credentials: AWS keys, or using X.509 certificates.
Using AWS Keys
--------------
1. Create a credential file: The deployment includes a template file ${AWS_RDS_HOME}/credential-file-path.template. Edit a copy of this file to add your information.
On UNIX, limit permissions to the owner of the credential file: $ chmod 600 <the file created above>.
2. There are several ways to provide your credential information:
a. Set the following environment variable: AWS_CREDENTIAL_FILE=<the file created in 1>
b. Alternatively, provide the following option with every command --aws-credential-file <the file created in 1>
c. Explicitly specify credentials on the command line: --I ACCESS_KEY --S SECRET_KEY
Using X.509 Certs
-----------------
1. Save your cetificate and private keys to files: e.g. my-cert.pem and my-pk.pem.
2. There are two ways to provide the certificate information to the command line tool:
a. Set the following environment variables:
EC2_CERT=/path/to/my-cert.pem
EC2_PRIVATE_KEY=/path/to/my-pk.pem
b. Specify the files directly on command-line for every command:
<command> --ec2-cert-file-path=/path/to/my-cert.pem --ec2-private-key-file-path=/path/to/my-pk.pem
Running:
---------
Check that your setup works properly, run the following command:
$ rds --help
You should see the usage page for all RDS commands.
$ rds-describe-db-instances --headers
If you have database instances already configured, you will see a header line followed by a description line for each database instance.
If you do not have any database instances yet, the command should simply run with no error output.
うむ、まずJava1.5以上を入れろと。たぶんVMだけ入れりゃいいんだろうけど今回はSDKまでいれるか。
Java SE ダウンロード - Sun Developer Network (SDN) 1.6update24 だな。
って思ったけどオラクルのアカウントがないとダウンロードさせてくれない糞オラクル糞糞ウンコオラクル仕様に変更になっていたので、ダウンロードしないで結局VMだけ入れる
D:\java\jre
ここにインストールした。
確認
>java -version java version "1.6.0_27" Java(TM) SE Runtime Environment (build 1.6.0_27-b07) Java HotSpot(TM) Client VM (build 20.2-b06, mixed mode, sharing)
できた。
D:\RDSCli
に置いた
D:\RDSCli\credential-file-path.template
というファイルがあるので適当な名前でコピー
AWSAccessKeyId=<Write your AWS access ID> AWSSecretKey=<Write your AWS secret key>
という記述があるここに、アカウント作った時に作ったやつ。
ここらへんで確認できる
を入れる
こんな使用頻度が低いコマンドのためにパスを通すのは面倒なので移動して実行する
D:\RDSCli\bin>rds --help AWS_RDS_HOME is not set
セットしろって
set AWS_RDS_HOME=D:\RDSCli
ドン
D:\RDSCli\bin>rds --help JAVA_HOME is not set
セットしろって
set JAVA_HOME=D:\java\jre
ドン!OK動いた。これも環境変数を汚したくないのでバッチファイルにして使う前に実行すればいいだろ
ここにキーの設定のところで作った設定ファイルのパスも通しておく
set AWS_RDS_HOME=D:\RDSCli set JAVA_HOME=D:\java\jre set AWS_CREDENTIAL_FILE=D:\RDSCli\credential
では一覧を見てみる。
指示通りドン
rds-describe-db-instances --headers
何も出ない・・・
よくわからんけどこうしないといけないみたいね。
rds-describe-db-instances -U https://rds.ap-northeast-1.amazonaws.com --headers
動いた確認できた。
メモ 1秒以上かかった重めのqueryをとる
rds-modify-db-parameter-group hoge --parameters="name=slow_query_log, value=ON, method=immediate" --parameters="name=long_query_time, value=1, method=immediate" -U https://rds.ap-northeast-1.amazonaws.com