CloudFormationのデバッグのしづらさは、きっとAWSの陰謀に違いない。
わからん。わからんすぎる。
なにがあった
セキュリティグループでね、当該グループ自身をセキュリティ許可のSourceにする、
ちょい特殊な定義をCloudFormationでしたかったんですよ。
無論、”AWS::EC2::SecurityGroup”の定義の中で自分自身を参照すると循環参照になっちゃうんで、
こうしたわけです。
"ElbSg" : { "Type" : "AWS::EC2::SecurityGroup", "Properties" : { "GroupDescription" : "HTTP and HTTPS Allow", "VpcId" : { "Ref" : "VpcId" }, } }, "ElbSgIngress" : { "Type" : "AWS::EC2::SecurityGroupIngress", "Properties" : [ { "IpProtocol" : "tcp", "FromPort" : "80", "ToPort" : "80", "GroupId" : { "Fn::GetAtt": [ "ElbSg", "GroupId" ] }, "SourceSecurityGroupId" : { "Fn::GetAtt": [ "ElbSg", "GroupId" ] } }, { "IpProtocol" : "tcp", "FromPort" : "443", "ToPort" : "443", "GroupId" : { "Fn::GetAtt": [ "ElbSg", "GroupId" ] }, "SourceSecurityGroupId" : { "Fn::GetAtt": [ "ElbSg", "GroupId" ] } } ] }
そしたらCloudFormationのスタック作成時にこうエラーが出るわけですな。
Template contains errors.: Template format error: Any Properties member must be a JSON object.
安西先生・・エラーの意味が・・わかりません・・。
で、どうした
ググったら、同じようにハマった人をForumで発見しました。
https://forums.aws.amazon.com/thread.jspa?threadID=106451
If you want multiple rules, you need to create multiple AWS::EC2::SecurityGroupIngress resources.
そうだったのかー。こうすればよかったのね。
許可したいエントリ毎に、”AWS::EC2::SecurityGroupIngress”を定義する。
"ElbSg" : { "Type" : "AWS::EC2::SecurityGroup", "Properties" : { "GroupDescription" : "HTTP and HTTPS Allow", "VpcId" : { "Ref" : "VpcId" }, } }, "ElbSgHTTPIngress" : { "Type" : "AWS::EC2::SecurityGroupIngress", "Properties" : { "IpProtocol" : "tcp", "FromPort" : "80", "ToPort" : "80", "GroupId" : { "Fn::GetAtt": [ "ElbSg", "GroupId" ] }, "SourceSecurityGroupId" : { "Fn::GetAtt": [ "ElbSg", "GroupId" ] } } }, "ElbSgHTTPSIngress" : { "Type" : "AWS::EC2::SecurityGroupIngress", "Properties" : { "IpProtocol" : "tcp", "FromPort" : "443", "ToPort" : "443", "GroupId" : { "Fn::GetAtt": [ "ElbSg", "GroupId" ] }, "SourceSecurityGroupId" : { "Fn::GetAtt": [ "ElbSg", "GroupId" ] } } }
とおった・・。
CloudFormation、Designerとかで具体的なエラー箇所を示してくれるとか、
もうちょっとなんとかなりまへんかねえ・・。
AWSエキスパート養成読本[Amazon Web Servicesに最適化されたアーキテクチャを手に入れる! ] (Software Design plus)
posted with amazlet at 16.03.21
吉田 真吾 今井 智明 大瀧 隆太 松井 基勝 冨永 善視 藤原 吉規 大栗 宗
技術評論社
売り上げランキング: 2,102
技術評論社
売り上げランキング: 2,102