简体   繁体   English

如何在亚马逊的云信息模板中列出现有子网?

[英]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.

相关问题 有没有办法从 CloudFormation 模板填充 Amazon DynamoDB 表? - Is there a way to populate an Amazon DynamoDB table from a CloudFormation template? cloudformation 无法创建子网 - cloudformation failed to create subnets 我如何 append 到字典中的现有数组列表? - How do I append to an existing array list in a dictionary? 向Cloudformation模板的参数文件添加列表 - Adding a list to the parameters file for Cloudformation template Django-如何正确地将模板列表发送到AJAX进行查看? - Django - How do I properly send a list from template to AJAX to view? 我如何在我的cloudformation堆栈中实现if条件 - how do I implement if condition in my cloudformation stack 如何将 cloudformation 内在函数放在 json 的字符串中 - How do I put cloudformation intrinsic functions inside a string in json AWS Cloudformation-如何在 json/yaml 模板中处理字符串大写或小写 - AWS Cloudformation- How to do string Uppercase or lowercase in json/yaml template 如何从Javascript中的现有对象创建新对象? - How do I create a new object from an existing object in Javascript? 如何从Amazon API Gateway的API将此Dynamo DB数据解析为Android? - How do I parse this Dynamo DB data into Android from an API from Amazon API Gateway?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM