2010年3月30日火曜日

EC2 Elastic Load BalancingのプライベートIPアドレスが変わる件 続

前回のEC2 Elastic Load BalancingのプライベートIPアドレスが変わる件で解決した。

えがったえがった

って思ってたら落とし穴が...

よくよく見たらSSLが全滅じゃん。
SSLは全部ELBのアドレスになってる。

でっ、フォーラムたどってみると...

Discussion Forumsの「Thread: Elastic Load Balancing Client IP?」に

The short answer is "you can't". 

The long answer: 
HTTPS traffic is regular HTTP traffic encrypted using SSL and sent over TCP port 443.
It is not possible to insert HTTP headers into HTTPS packets without decrypting the packets.
Normally only the two endpoints can decrypt the packets.
This can be accomplished in a load-balancing setup if the load balancer
supports "SSL offloading" (also known as SSL acceleration).
But ELB does not support SSL offloading. 

だってさ...orz
いつ、対応してくれるんだよ。

あきらめて自分で立てるしかないのかなぁ。
じゃあ、AutoScalingどうするんだって話だよ。

2010年3月24日水曜日

EC2 Elastic Load BalancingのプライベートIPアドレスが変わる件

アクセスログの解析にリモートホストも使っているのだけれど
ある時からElastic Load BalancingのプライベートIPアドレス
が変わっていたのでmod_rpafに設定したIPアドレスが無効になり
アクセスログが全て同じIPアドレス(ELBのアドレス)に
なっていた... orz

mod_rpafはIPアドレスをビットでは指定できないし...
どうしたもんかと now loading...

もう、mod_rpaf書き換えちまえYO!
ってことで以下のようにした。

mod_rpaf-2.0.cの142行目辺りの
if (strcmp(remote_ip, list[i]) == 0)

if (strncmp(remote_ip, list[i], strlen(list[i])) == 0)
として

rpaf.confのRPAFproxy_ipsを
RPAFproxy_ips 10.

としてAクラスから来たものは強制的に。
もっと、他の方法があるんじゃないかと思ったけど
思い浮かばないし、誰か同じことで悩んでる方ご助言を。

あっ、一応上記でも動いてます。

EC2 Elastic Load Balancing設定

久しぶりにやって忘れたので残しとく。

ロードバランサの作成
# elb-create-lb test-lb --headers --listener "lb-port=80,instance-port=80,protocol=http" --listener "lb-port=443,instance-port=443,protocol=tcp" --availability-zones us-east-1b

ロードバランサにインスタンス登録
# elb-register-instances-with-lb test-lb --instances i-AAAAAAAA

ロードバランサ確認
# elb-describe-lbs


基本elb系のコマンドで。

2010年3月10日水曜日

EC2 AutoScaling(自動スケーリング設定)

EC2を自動スケーリングするように設定した。
てっきり、CloudWatchでモニタリングして自分でインスタンス立ち上げて
ロードバランサに割り当てるもんだと思ってたがAutoScaling設定しとけば
勝手にやってくれるのね。

ってことで、以下のような感じで。

コンフィグ設定
サンプルパラメータは名前 AMI名 AMIのタイプ
# as-create-launch-config test-lc --image-id ami-TEST --instance-type m1.large

スケーリンググループ作成
サンプルパラメータは名前 コンフィグ名 ゾーン 最小構成 最大構成 ロードバランサ名
ロードバランサに割り当てる場合は--load-balancersを指定する。
(ロードバランサは事前に作成しておく)
# as-create-auto-scaling-group test-sgroup --launch-configuration test-lc --availability-zones us-east-1b --min-size 1 --max-size 5 --load-balancers test-lb

トリガ設定
サンプルパラメータは名前 スケーリンググループ名 モニタリング項目 閾値の項目 モニタリングの設定 モニタリング間隔 閾値を下回った場合のスケール 閾値を上回った場合のスケール 閾値を越えた場合の実行秒
# as-create-or-update-trigger test-trigger --auto-scaling-group test-sgroup --measure CPUUtilization --statistic Average --dimensions "AutoScalingGroupName=test-sgroup" --period 60 --lower-threshold 20 --upper-threshold 80 --lower-breach-increment=-1 --upper-breach-increment 1 --breach-duration 120


その他確認コマンドは

コンフィグ設定の確認
# as-describe-launch-configs

スケーリンググループの確認
# as-describe-auto-scaling-groups

トリガの確認
パラメータにスケーリンググループ名
# as-describe-triggers test-sgroup

細かいマニュアルは --help で。

2010年3月6日土曜日

また本買ってもうた

いや、存在は知ってたけどなんか買う気がおきず
立ち読みしたら気になったもので。。。