[英]How do I list existing subnets in a cloudformation template from Amazon?
I am using the template that makes a Multi-AZ lamp stack. 我正在使用制作多AZ灯堆栈的模板。 The only things I am changing are the existing VPC ID, adding the 2 existing subnets, and naming the RDB database, user and pass. 我要改变的唯一事情是现有的VPC ID,添加2个现有的子网,并命名RDB数据库,用户和传递。 The code validates ok when I click the check button, but when I try to launch the network it fails with the code error, "Template contains errors.: Template format error: Every Description member must be a string." 单击检查按钮时代码验证正常,但是当我尝试启动网络时,它失败并出现代码错误,“模板包含错误:模板格式错误:每个描述成员必须是一个字符串。”
I have been looking for example SIMPLE templates, that do not use any foo-bar type "everybody knows this is to be filled with their own value" stuff. 我一直在寻找示例SIMPLE模板,不使用任何foo-bar类型“每个人都知道这是填充自己的价值”的东西。 I have been putting in hours of search and test. 我一直在进行数小时的搜索和测试。 This is the first one I have ever done, and it just cannot be all that hard, right? 这是我做过的第一次,它不是那么难,对吧? I am using the suggested list of AMIs, though in the future I will put in my customized AMI instead. 我正在使用建议的AMI列表,但将来我会放入我自定义的AMI。
"Parameters" : {
"VpcId" : {
"Type" : "AWS::EC2::VPC::Id",
"Description" : "vpc-123456789456",
"ConstraintDescription" : "must be the VPC Id of an existing Virtual Private Cloud."
},
"Subnets" : {
"Type" : "List<AWS::EC2::Subnet::Id>",
"Description" : [
"subnet-12345621ff4c" ,
"subnet-1234562188d1"],
This is the only one I have found that doesn't throw errors saying "Expecting a ':' instead of a ','" Should I be listing the name as "List" 这是我发现的唯一一个没有抛出错误的错误,说“期待':'而不是','”我应该将名称列为“列表”
"Description"
has to be a string. "Description"
必须是一个字符串。 It's a textual description that shows up in the UI when you create the stack. 这是在创建堆栈时在UI中显示的文本描述。
I think you're looking for either "Default"
or "AllowedValues"
. 我认为你正在寻找"Default"
或"AllowedValues"
。 The first will set the default value in case your template user doesn't specify anything. 第一个将设置默认值,以防模板用户未指定任何内容。 To put a list of values, you need to separate them by a comma. 要放置值列表,您需要用逗号分隔它们。 For example: 例如:
"Parameters": {
"VpcId": {
"Type": "AWS::EC2::VPC::Id",
"Default": "vpc-123456789456",
"ConstraintDescription": "must be the VPC Id of an existing Virtual Private Cloud."
},
"Subnets": {
"Type": "List<AWS::EC2::Subnet::Id>",
"Default": "subnet-12345621ff4c,subnet-1234562188d1"
}
}
The second is a list of allowed values the user can select. 第二个是用户可以选择的允许值列表。 That one actually does take a list. 那个人确实拿了一份清单。 For example: 例如:
"Parameters": {
"VpcId": {
"Type": "AWS::EC2::VPC::Id",
"AllowedValues": ["vpc-123456789456", "vpc-xxx"],
"ConstraintDescription": "must be the VPC Id of an existing Virtual Private Cloud."
}
}
I'm not sure if "ConstraintDescription"
will show if the user selects a wrong one. 我不确定"ConstraintDescription"
是否会显示用户是否选择了错误的一个。 I think that only applies to "AllowedPattern"
. 我认为这仅适用于"AllowedPattern"
。
Yes, it can be that hard and very frustrating, but it does get easier over time. 是的,它可能很难但非常令人沮丧,但随着时间的推移它会变得更容易。 The learning curve is steep. 学习曲线陡峭。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.