我不是JSON專家,但我能夠操縱AWS Beanstalk VPC cloudformation模板以從S3抽取.WAR文件並將其部署爲新應用程序。我還操縱腳本爲public創建了另外兩個子網1,另一個用於私有,而不是僅創建2個子網的原始腳本。我遇到了下面一段代碼的問題。我需要操作,以便EC2實例和ELB使用我在腳本中創建的其他子網。所以對於值子網我需要添加PrivateSubnet和PrivateSubnet2。 ELBs的值也是一樣的。向ELB和子網添加子網Cloudformation Beanstalk腳本中的值
"SampleEnvironment" : {
"Type" : "AWS::ElasticBeanstalk::Environment",
"Properties" : {
"ApplicationName" : { "Ref" : "SampleApplication" },
"EnvironmentName" : "Sandbox",
"Description" : "AWS Elastic Beanstalk Environment running Python Sample Application",
"SolutionStackName" : "64bit Amazon Linux 2014.02 running Tomcat 7 Java 7",
"OptionSettings" : [
{"Namespace" : "aws:autoscaling:launchconfiguration", "OptionName" : "SSHSourceRestriction", "Value" : { "Fn::Join" : [ "", ["tcp,22,22,", { "Ref" : "BastionSecurityGroup" }]]}},
{"Namespace" : "aws:autoscaling:launchconfiguration", "OptionName" : "SecurityGroups", "Value" : { "Ref" : "BeanstalkSecurityGroup" }},
{"Namespace" : "aws:autoscaling:launchconfiguration", "OptionName" : "EC2KeyName", "Value" : { "Ref" : "InstanceKeyName" }},
{"Namespace" : "aws:ec2:vpc", "OptionName" : "VPCId", "Value" : { "Ref" : "VPC" }},
{"Namespace" : "aws:ec2:vpc", "OptionName" : "Subnets", "Value" : { "Ref" : "PrivateSubnet" }},
{"Namespace" : "aws:ec2:vpc", "OptionName" : "ELBSubnets", "Value" : { "Ref" : "PublicSubnet" }}],
"VersionLabel" : "Initial Version"
}
}
},
任何幫助將不勝感激..過這個,而我試圖找到答案對同一問題
你在哪裏創建額外的子網?在同一個CloudFormation模板中?請添加這些細節。 – Jason
是的,它們都在相同的腳本/模板中。 – user2040074