是否可以将EC2实例模板的VPCId定义为属性?为VPC创建EC2实例不允许
我试图做的是一样的东西,
"Resources" : {
"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"SecurityGroups": [ { "Ref": "AWSSecurityGroups" } ],
"KeyName" : { "Ref" : "KeyName" },
"InstanceType" : { "Ref" : "InstanceType" },
"Tags" : [ { "Key" : "Name", "Value" : "Softnas-CF" }],
"ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]},
"VpcId" : { "Ref" : "VPCId" },
.....some other stuff...
},
在我的参数,我定义VPCId,
"Parameters" : {
....
"VPCId": {
"Description": "Name of an existing VPC ID",
"Type": "AWS::EC2::VPC::Id",
"ConstraintDescription": "must be the name of an existing VPC Id."
},
...
},
但是,当我创建堆栈(通过。 net api),它回滚出错
遇到不支持的属性VpcId
是不是允许这样做,我找不到任何文档来做到这一点。做这个实验。如果使用模板创建EC2实例始终是在默认VPC中创建的?
对于酒店?我已经尝试过并更新了这个问题。 – Dhanuka777
@ Dhanuka777,对不起,我没有正确阅读你的Q. – helloV