2012年9月1日土曜日

Auto Scaling から起動するインスタンスに Security Group を設定する

Auto Scaling を使ってインスタンスを起動する場合、Security Group を指定しないと default が設定されます。

Security Group を指定したい場合は、Launch Configuration を作成する時に group を設定します。
$ as-create-launch-config --help
…
   --group VALUE1,VALUE2,VALUE3...
       Security groups with which to associate the Amazon EC2 instances. Note
       that Amazon VPC security groups and Amazon EC2 security groups are
       mutually exclusive and can't be used together. Either all group names or
       all group ids are acceptable, but not both.

Auto Scaling Developer Guide には詳しく書いてなくて、色々調べた後に、コマンドのヘルプに書いてあることを知った。最初にココを見るべきだった。

command line tool のオプションは API と対応しているから、API Reference を参照して、まずオプションの有無を調べてみるのもいいかもしれない。

Auto Scaling API Reference - CreateLaunchConfiguration
SecurityGroups.member.N

The names of the security groups with which to associate Amazon EC2 or Amazon VPC instances. Specify Amazon EC2 security groups using security group names, such as websrv. Specify Amazon VPC security groups using security group IDs, such as sg-12345678. 

0 件のコメント:

コメントを投稿